コード例 #1
0
ファイル: CropController.cs プロジェクト: yoavShaked/NegevApp
        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());
            }
        }
コード例 #2
0
        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());
            }
        }