public Response UpdateDeliveryDetails(DeliveryUnitDetails obj) { var IsExist = entities.deliveryunits.Where(x => x.id == obj.id).ToList(); if (IsExist.Count != 0) { var itemObj = entities.deliveryunits.Where(x => x.id == obj.id).FirstOrDefault(); itemObj.id = obj.id; itemObj.name = obj.name; itemObj.distributorname = obj.distributorname; itemObj.distributorid = obj.distributorid; itemObj.productid = obj.productid; itemObj.productname = obj.productname; itemObj.quantity = obj.quantity; itemObj.createdOn = DateTime.Now; itemObj.isactive = false; entities.SaveChanges(); return(new Response { IsSuccess = true, Message = "Order Delivered successfully to: " + obj.name }); } else { return new Response { IsSuccess = false, Message = "Manufacturer already exists" } }; } #endregion }
public ActionResult DeliverOrder(string id, string name, string productname, string productid, string quantity, string distributorname, string distributorid) { if (id == "" || id == null) { id = "0"; } if (productid == "" || productid == null) { productid = "0"; } if (quantity == "" || quantity == null) { quantity = "0"; } if (distributorid == "" || distributorid == null) { distributorid = "0"; } Response res = new Response(); List <object> resultList = new List <object>(); var idFlag = Int32.Parse(id); DeliveryUnitDetails distItem = new DeliveryUnitDetails(); distItem.id = idFlag; distItem.name = name; distItem.productid = Int32.Parse(productid); distItem.productname = productname; distItem.distributorid = Int32.Parse(distributorid); distItem.distributorname = distributorname; distItem.quantity = Int32.Parse(quantity); res = masterDal.UpdateDeliveryDetails(distItem); resultList.Add(res); resultList.Add(GetAllDeliveryDetails()); return(Json(resultList, JsonRequestBehavior.AllowGet)); }
public Response SaveDeliveryDetails(DeliveryUnitDetails obj) { deliveryunit itemObj = new deliveryunit(); itemObj.id = obj.id; itemObj.name = obj.name; itemObj.distributorid = obj.distributorid; itemObj.distributorname = obj.distributorname; itemObj.productid = obj.productid; itemObj.productname = obj.productname; itemObj.quantity = obj.quantity; itemObj.createdOn = DateTime.Now; itemObj.isactive = true; entities.deliveryunits.Add(itemObj); entities.SaveChanges(); return(new Response { IsSuccess = true, Message = "Order Transferred to delivery unit: " + obj.name }); }