public HttpResponseMessage PutConsumerComModel(int id, ConsumerComModel data) { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } if (id != data.ID) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } var tempdata = ConsumerComModel.MaptoEntity(data); tempdata.ModifiedBy = "user"; tempdata.ModifiedDate = DateTime.Today; try { BusinessFacade.Consumer.Update(tempdata); } catch (Exception ex) { throw(ex); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage PostConsumerComModel(ConsumerComModel data) { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } var tempdata = ConsumerComModel.MaptoEntity(data); tempdata.CreatedBy = "user"; tempdata.CreatedDate = DateTime.Today; BusinessFacade.Consumer.Create(tempdata); return(Request.CreateResponse(HttpStatusCode.OK, tempdata.ID)); }