public IHttpActionResult GetAllCrops() { try { using (EntitiesNegev4 context = new EntitiesNegev4()) { IHttpActionResult response = StatusCode(System.Net.HttpStatusCode.ServiceUnavailable); List <ILightWeight> cropsToSend = m_CropHendler.GetAllTable(context) as List <ILightWeight>; if (cropsToSend.Count > 0) { response = Ok(cropsToSend); } return(response); } } catch { return(NotFound()); } }
public IHttpActionResult GetAllCrops() { try { using (EntitiesNegev4 context = new EntitiesNegev4()) { IHttpActionResult response = NotFound(); List <Crop> cropsToSend = m_CropHendler.GetAllTable(context) as List <Crop>; if (cropsToSend.Count > 0) { response = Ok(cropsToSend); } return(response); } } catch { return(NotFound()); } }