コード例 #1
0
ファイル: CropController.cs プロジェクト: yoavShaked/NegevApp
        public IHttpActionResult PostNewCrop(Crop i_PostedCrop)
        {
            using (EntitiesNegev4 context = new EntitiesNegev4())
            {
                IHttpActionResult response = Ok();
                bool ok = true;

                try
                {
                    m_CropHendler.PostNewRow(i_PostedCrop, context);
                }
                catch
                {
                    response = StatusCode(System.Net.HttpStatusCode.ServiceUnavailable);
                    ok       = false;
                }
                if (ok)
                {
                    List <ILightWeight> cropToSend = m_CropHendler.GetAllTable(context) as List <ILightWeight>;
                    response = Ok(cropToSend);
                }

                return(response);
            }
        }