public ActionResult Create(VendorViewModel vendor) { if (ModelState.IsValid) { vendor.LoggedOnUser = SessionVars.UserName; vendor.SaveViewModel(); TempData["Success"] = "Vendor created successfully!"; return(RedirectToAction("Edit", new { controller = "Vendor", id = vendor.Id })); } return(View(vendor)); }
public ActionResult Edit(VendorViewModel vendor) { if (!Calibrus.SparkPortal.Business.LoginLogic.IsClientAdmin(SessionVars.UserName) && vendor.OfficeList.Any(o => o.Users.Any(x => x.UserName != SessionVars.UserName))) { return(RedirectToAction("AccessDenied", new { controller = "Error" })); } if (ModelState.IsValid) { vendor.LoggedOnUser = SessionVars.UserName; vendor.SaveViewModel(); TempData["Success"] = "Program updated successfully!"; return(RedirectToAction("Edit", new { controller = "Vendor", id = vendor.Id })); } return(View(vendor)); }