public DeleteSuplierVm GetDeleteSupplierVm(int id) { Supplier supplier = this.Context.Suppliers.Find(id); DeleteSuplierVm vm = Mapper.Map <Supplier, DeleteSuplierVm>(supplier); return(vm); }
public ActionResult Delete(int id) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("All")); } DeleteSuplierVm vm = this.service.GetDeleteSupplierVm(id); return(this.View(vm)); }
public ActionResult Delete([Bind(Include = "Id")] DeleteSupplierBm bind) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticationManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("All")); } if (!this.ModelState.IsValid) { DeleteSuplierVm vm = this.business.GetDeleteSupplierVm(bind.Id); return(this.View(vm)); } User loggedInUser = AuthenticationManager.GetAuthenticatedUser(httpCookie.Value); this.business.DeleteSupplier(bind, loggedInUser.Id); return(this.RedirectToAction("All")); }