public void AddSupplier(AddSupplierBindingModel bind, int id) { Supplier supplier = Mapper.Map <AddSupplierBindingModel, Supplier>(bind); this.Context.Suppliers.Add(supplier); this.Context.SaveChanges(); this.AddLog(id, OperationLog.Add, "suppliers"); }
public ActionResult CreateSupplier([Bind(Include = "Name, Telephone")] AddSupplierBindingModel model) { if (ModelState.IsValid) { this.service.AddSupplier(model); return(this.RedirectToAction("Suppliers")); } return(this.RedirectToAction("CreateSupplier")); }
public ActionResult Add(AddSupplierBindingModel supplierBm) { if (!UserInfo.IsLogged) { return(this.RedirectToAction("Login", "Users")); } this.suppliersService.AddNewSupplier(supplierBm); return(this.RedirectToAction("Index")); }
public void AddSupplier(AddSupplierBindingModel model) { Supplier supplier = new Supplier() { Name = model.Name, Telephone = model.Telephone }; this.Context.Suppliers.Add(supplier); this.Context.SaveChanges(); }
public void AddNewSupplier(AddSupplierBindingModel supplierBm) { var supplier = new Supplier() { Name = supplierBm.Name, IsImporter = supplierBm.IsImporter }; this.suppliers.Add(supplier); this.suppliers.SaveChanges(); }
public ActionResult Add([Bind(Include = "Name,IsImporter")] AddSupplierBindingModel bind) { var httpCookie = this.Request.Cookies.Get("sessionId"); if (httpCookie == null || !AuthenticatedManager.IsAuthenticated(httpCookie.Value)) { return(this.RedirectToAction("All")); } User loggedInUser = AuthenticatedManager.GetAuthenticatedUsers(httpCookie.Value); this.service.AddSupplier(bind, loggedInUser.Id); return(this.RedirectToAction("All")); }
public void AddSupplier(AddSupplierBindingModel model) { throw new NotImplementedException(); }