public RedirectToRouteResult AddNewBin(Bin bin) { using (SSISdbEntities e = new SSISdbEntities()) { string itemCode = Request.Form["SelectBinItem"].ToString(); int binCount = e.Bins.Count() + 1; bin.Number = binCount; bin.ItemCode = itemCode; bin.Active = 1; DAL.BinRepositoryImpl dal = new DAL.BinRepositoryImpl(e); dal.InsertBin(bin); e.SaveChanges(); return(RedirectToAction("Maintenance", "Store")); } }
public RedirectToRouteResult EditBin(FullBinModel[] arr) { using (SSISdbEntities e = new SSISdbEntities()) { DAL.BinRepositoryImpl dal = new DAL.BinRepositoryImpl(e); FullBinModel model = arr[0]; Bin bin = new Bin(); bin.Number = model.Number; bin.Active = 1; bin.Location = model.Location; bin.ItemCode = e.Items.Where(x => x.Description == model.ItemDesc).Select(x => x.ItemCode).FirstOrDefault(); dal.UpdateBin(bin); e.SaveChanges(); Session["MaintenanceStoreBinPage"] = "1"; return(RedirectToAction("Maintenance", "Store")); } }