public HttpResponseMessage CreateDeliveryTypeLookUp(DeliveryTypeLookUpModel _DeliveryTypeLookUpModel) { try { DELIVERY_TYPE_LOOKUP dtlu = new DELIVERY_TYPE_LOOKUP(); dtlu.ID = _DeliveryTypeLookUpModel.ID; dtlu.CODE = _DeliveryTypeLookUpModel.CODE; dtlu.NAME = _DeliveryTypeLookUpModel.NAME; if (!db.DELIVERY_TYPE_LOOKUP.Any(a => a.ID == dtlu.ID)) { db.DELIVERY_TYPE_LOOKUP.Add(dtlu); db.SaveChanges(); } else { return(Request.CreateResponse(HttpStatusCode.BadRequest, "duplicate key")); } } catch { throw; } return(Request.CreateResponse(HttpStatusCode.OK, "success")); }
public DeliveryTypeViewModel() { selectedDeliveryType = new DeliveryTypeLookUpModel(); AddButtonVisibility = Visibility.Visible; EditButtonVisibility = Visibility.Hidden; GROUP_BOX_TITLE = "Add Delivery Type"; }
public HttpResponseMessage DeleteDeliveryTypeLookUp(DeliveryTypeLookUpModel _DeliveryTypeLookUpModel) { try { DELIVERY_TYPE_LOOKUP dtlu = new DELIVERY_TYPE_LOOKUP(); dtlu.ID = _DeliveryTypeLookUpModel.ID; dtlu.CODE = _DeliveryTypeLookUpModel.CODE; dtlu.NAME = _DeliveryTypeLookUpModel.NAME; db.DELIVERY_TYPE_LOOKUP.Attach(dtlu); db.DELIVERY_TYPE_LOOKUP.Remove(dtlu); db.SaveChanges(); } catch { throw; } return(Request.CreateResponse(HttpStatusCode.OK, "success")); }
public HttpResponseMessage UpdateDeliveryTypeLookUp(DeliveryTypeLookUpModel _DeliveryTypeLookUpModel) { try { DELIVERY_TYPE_LOOKUP dtlu = new DELIVERY_TYPE_LOOKUP(); dtlu.ID = _DeliveryTypeLookUpModel.ID; dtlu.CODE = _DeliveryTypeLookUpModel.CODE; dtlu.NAME = _DeliveryTypeLookUpModel.NAME; db.DELIVERY_TYPE_LOOKUP.Attach(dtlu); db.Entry(dtlu).State = System.Data.EntityState.Modified; db.SaveChanges(); } catch { throw; } return(Request.CreateResponse(HttpStatusCode.OK, "success")); }