0
[Route("api/Student/{name}")]
public HttpResponseMessage Get(string name)
{
using (studentContext sc = new studentContext())
{
var entity = sc.Students.Where(x => x.Name.StartsWith(name)) ;
if (entity != null)
{
return Request.CreateResponse(HttpStatusCode.OK, entity);
}
else
{
return Request.CreateResponse(HttpStatusCode.NotFound, "Staff with name:" + name.ToString() + "not found");
}
}
}
什麼excactly不工作?你收到錯誤嗎? – Marco