Exemplo n.º 1
0
        public void DeleteSupplier(DeleteSupplierBindingModel model)
        {
            Supplier supplier = this.Context.Suppliers.Find(model.Id);

            this.Context.Suppliers.Remove(supplier);
            this.Context.SaveChanges();
        }
Exemplo n.º 2
0
 public ActionResult DeleteSupplier([Bind(Include = "Id")] DeleteSupplierBindingModel model)
 {
     if (ModelState.IsValid)
     {
         this.service.DeleteSupplier(model);
         return(this.RedirectToAction("Suppliers"));
     }
     return(this.RedirectToAction("DeleteSupplier"));
 }
Exemplo n.º 3
0
        public void DeleteSupplier(DeleteSupplierBindingModel bind, int id)
        {
            Supplier supplier = this.Context.Suppliers.Find(bind.Id);

            this.Context.Suppliers.Remove(supplier);
            this.Context.SaveChanges();

            this.AddLog(id, OperationLog.Delete, "suppliers");
        }
Exemplo n.º 4
0
        public ActionResult Delete([Bind(Include = "Id")] DeleteSupplierBindingModel bind)
        {
            var httpCookie = this.Request.Cookies.Get("sessionId");

            if (httpCookie == null || !AuthenticatedManager.IsAuthenticated(httpCookie.Value))
            {
                return(this.RedirectToAction("All"));
            }

            if (!this.ModelState.IsValid)
            {
                DeleteSuplierViewModel vm = this.service.GetDeleteSupplierVm(bind.Id);
                return(this.View(vm));
            }

            User loggedInUser = AuthenticatedManager.GetAuthenticatedUsers(httpCookie.Value);

            this.service.DeleteSupplier(bind, loggedInUser.Id);
            return(this.RedirectToAction("All"));
        }
 public void DeleteSupplier(DeleteSupplierBindingModel model)
 {
     throw new NotImplementedException();
 }