public int EditPaneltyMaster(PaneltyMasterModel model) { Hashtable HT = new Hashtable(); HT.Add("PaneltyMasterID", model.PaneltyMasterID); HT.Add("PaneltyType", model.PaneltyType); HT.Add("Amount", model.Amount); HT.Add("Description", model.Description); int i = dbContext.ExecuteSP("udp_PaneltyMaster_ups", HT); return i; }
//insert customer public HttpResponseMessage Post(PaneltyMasterModel PaneltyMaster) { if (ModelState.IsValid) { db.AddPaneltyMaster(PaneltyMaster); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, PaneltyMaster); response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = PaneltyMaster.PaneltyMasterID })); return response; } else { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } }
//update customer public HttpResponseMessage Put(int id, PaneltyMasterModel PaneltyMaster) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } if (id != PaneltyMaster.PaneltyMasterID) { return Request.CreateResponse(HttpStatusCode.BadRequest); } try { db.EditPaneltyMaster(PaneltyMaster); } catch (DbUpdateConcurrencyException ex) { return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex); } return Request.CreateResponse(HttpStatusCode.OK); }