Пример #1
0
        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");
        }
Пример #2
0
 public ActionResult CreateSupplier([Bind(Include = "Name, Telephone")] AddSupplierBindingModel model)
 {
     if (ModelState.IsValid)
     {
         this.service.AddSupplier(model);
         return(this.RedirectToAction("Suppliers"));
     }
     return(this.RedirectToAction("CreateSupplier"));
 }
Пример #3
0
        public ActionResult Add(AddSupplierBindingModel supplierBm)
        {
            if (!UserInfo.IsLogged)
            {
                return(this.RedirectToAction("Login", "Users"));
            }

            this.suppliersService.AddNewSupplier(supplierBm);

            return(this.RedirectToAction("Index"));
        }
Пример #4
0
        public void AddSupplier(AddSupplierBindingModel model)
        {
            Supplier supplier = new Supplier()
            {
                Name      = model.Name,
                Telephone = model.Telephone
            };

            this.Context.Suppliers.Add(supplier);
            this.Context.SaveChanges();
        }
Пример #5
0
        public void AddNewSupplier(AddSupplierBindingModel supplierBm)
        {
            var supplier = new Supplier()
            {
                Name       = supplierBm.Name,
                IsImporter = supplierBm.IsImporter
            };

            this.suppliers.Add(supplier);
            this.suppliers.SaveChanges();
        }
Пример #6
0
        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();
 }