public ActionResult CreateTransfer(int id) { if (!WebSecurity.IsAuthenticated) { return(RedirectToAction("Login", "Account")); } else { if (!Roles.GetRolesForUser(WebSecurity.CurrentUserName)[0].Equals("headOffice")) { WebSecurity.Logout(); return(RedirectToAction("Login", "Account")); } } a = 0; TransferRecord record = new TransferRecord() { outlet_Id = id }; ShoesTransferViewModel model = new ShoesTransferViewModel(); model.transferRecord = record; model.shoes = habib.Shoes.ToList(); ViewBag.transfer = "active"; ViewBag.orderDisplaya = "block"; ViewBag.createTransfer = "active"; return(View(model)); }
public ActionResult CreateTransfer(ShoesTransferViewModel model, FormCollection form) { TransferHandler handler = new TransferHandler(); TransferRecord record = new TransferRecord() { outlet_Id = model.transferRecord.outlet_Id, dateOfTransfer = model.transferRecord.dateOfTransfer }; habib.TransferRecords.Add(record); habib.SaveChanges(); int outletId = Convert.ToInt32(model.transferRecord.outlet_Id); record.shoesTransfered = handler.TransferShoes(record.transfer_Id, outletId, model.shoes, model.sizes, model.colors, model.qty); habib.SaveChanges(); return(View("OutletSelect")); }