// POST api/Delete public HttpResponseMessage Post(WebApiParams param) { // 結果表示するメッセージ string message = ""; Dictionary<string, string> dic = new Dictionary<string, string>(); // B層呼出し+都度コミット LayerB layerB = new LayerB(); layerB.Delete(param); // 結果(正常系) message = param.Obj.ToString() + "件削除"; dic.Add("Message", message); return Request.CreateResponse(HttpStatusCode.OK, dic); }
// POST api/SelectListEF public HttpResponseMessage Post(WebApiParams param) { // B層呼出し+都度コミット LayerB layerB = new LayerB(); layerB.SelectAll_List(param); // 結果(正常系) List<Shipper> shipperData = new List<Shipper>(); shipperData = (List<Shipper>)param.Obj; return Request.CreateResponse(HttpStatusCode.OK, shipperData); }
// POST api/Select public HttpResponseMessage Post(WebApiParams param) { // B層呼出し+都度コミット LayerB layerB = new LayerB(); layerB.SelectByCondition(param); // 結果(正常系) List<Shipper> shipperData = new List<Shipper>(); shipperData = (List<Shipper>)param.Obj; if (shipperData.Count == 0) { // 結果表示するメッセージ string message = ""; Dictionary<string, string> dic = new Dictionary<string, string>(); // 結果(正常系) message = "No records found"; dic.Add("NoRecords", message); return Request.CreateResponse(HttpStatusCode.OK, dic); } else { return Request.CreateResponse(HttpStatusCode.OK, shipperData); } }