public HttpResponseMessage Get(int categoryid) { HttpResponseMessage msg = null; var result = entities.Article_Categories.Include("Articles").Where(f => f.Code == categoryid).FirstOrDefault(); if (result == null) { msg = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Nothing Found Here"); } else { msg = Request.CreateResponse(HttpStatusCode.OK, TheCategoryFactory.Create(result)); } return(msg); }
public HttpResponseMessage Get(short categoryid) { HttpResponseMessage msg = null; var results = entities.Articles.Include("Article_Category1") .Where(m => m.Article_Category1.Code == categoryid) .ToList() .Select(m => TheCategoryFactory.Create(m)); if (results == null) { msg = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Nothing Found here"); } else { msg = Request.CreateResponse(HttpStatusCode.OK, results); } return(msg); }