public HttpResponseMessage InsertOrder([FromBody] ORDER oderdata) { if (oderdata != null) { using (var context = new ordermgmtDBEntities()) { var resultObject = context.ORDERS.Add(oderdata); int newlyinsertedOrderId = context.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, newlyinsertedOrderId)); } } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Not Inserted")); } }
public HttpResponseMessage UpdateDeliveryStatus([FromBody] ORDER oderdata) { if (oderdata != null) { using (var context = new ordermgmtDBEntities()) { var newOrderData = new ORDER(); newOrderData = oderdata; var resultObject = context.ORDERS.Add(newOrderData); context.Entry(newOrderData).State = System.Data.Entity.EntityState.Modified; int newlyinsertedOrderId = context.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, newlyinsertedOrderId)); } } else { return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Not updated")); } }