Example #1
0
        public ActionResult Create()
        {
            var model = new ProductModel();

            model.Categories = CategoryContainer.GetCategories();
            model.Markets    = MarketContainer.GetMarkets();
            return(View(model));
        }
Example #2
0
        // GET: Deliveries/Create
        public ActionResult Create()
        {
            var model = new EmployeeModel();

            model.Markets = MarketContainer.GetMarkets();

            return(View(model));
        }
Example #3
0
        public ActionResult Create()
        {
            var model = new DeliveryModel();

            model.Markets   = MarketContainer.GetMarkets();
            model.Suppliers = SupplierContainer.GetSuppliers();

            return(View(model));
        }
Example #4
0
        // GET: Suppliers
        public ActionResult Index()
        {
            var employees = EmployeeContainer.GetEmployees();
            var markets   = MarketContainer.GetMarkets();

            foreach (var emp in employees)
            {
                emp.MarketName = markets.FirstOrDefault(x => x.ID == emp.MagazinID).Denumire;
            }

            return(View(employees));
        }
Example #5
0
        // GET: Deliveries/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var model = new EmployeeModel();

            model.Employee = EmployeeContainer.getEmployeeById((int)id);
            model.Markets  = MarketContainer.GetMarkets();

            return(View(model));
        }
Example #6
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                EmployeeContainer.SaveEmployee(employee);
                return(RedirectToAction("Index"));
            }
            var model = new EmployeeModel();

            model.Employee = employee;
            model.Markets  = MarketContainer.GetMarkets();

            return(View(model));
        }
Example #7
0
        public ActionResult Index()
        {
            var products   = ProductsContainer.GetProducts();
            var categories = CategoryContainer.GetCategories();
            var markets    = MarketContainer.GetMarkets();

            foreach (var prod in products)
            {
                prod.CategoryName = categories.Where(el => el.ID == prod.CategorieID).FirstOrDefault().Nume;
                prod.MarketName   = markets.Where(el => el.ID == prod.MagazinID).FirstOrDefault().Denumire;
            }

            return(View(products));
        }
Example #8
0
        public ActionResult Index()
        {
            var markets   = MarketContainer.GetMarkets();
            var suppliers = SupplierContainer.GetSuppliers();
            var delivery  = DeliveryContainer.GetDeliveries();

            foreach (var del in delivery)
            {
                del.SupplierName = suppliers.FirstOrDefault(x => x.ID == del.FurnizorID).Nume;
                del.MarketName   = markets.FirstOrDefault(x => x.ID == del.MagazinID).Denumire;
            }

            return(View(delivery));
        }
Example #9
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var model = new ProductModel();

            model.Product    = ProductsContainer.getProductById((int)id);
            model.Categories = CategoryContainer.GetCategories();
            model.Markets    = MarketContainer.GetMarkets();

            return(View(model));
        }
Example #10
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var model = new DeliveryModel();

            model.Delivery  = DeliveryContainer.getDeliveryById((int)id);
            model.Markets   = MarketContainer.GetMarkets();
            model.Suppliers = SupplierContainer.GetSuppliers();

            return(View(model));
        }
        public ActionResult Edit(Delivery delivery)
        {
            if (ModelState.IsValid && DeliveriesController.validateStatus((int)Session["role"], delivery.Status))
            {
                DeliveryContainer.SaveDelivery(delivery);
                return(RedirectToAction("Index"));
            }

            var model = new DeliveryModel();

            model.Delivery  = delivery;
            model.Suppliers = SupplierContainer.GetSuppliers();
            model.Markets   = MarketContainer.GetMarkets();
            return(View(model));
        }
        public ActionResult Create(Delivery delivery)
        {
            if (ModelState.IsValid)
            {
                delivery.Status         = delivery.Status != null ? delivery.Status : "Initiata";
                delivery.DataSolicitare = DateTime.Now;
                DeliveryContainer.SaveDelivery(delivery);
                return(RedirectToAction("Index"));
            }
            var model = new DeliveryModel();

            model.Delivery  = delivery;
            model.Suppliers = SupplierContainer.GetSuppliers();
            model.Markets   = MarketContainer.GetMarkets();
            return(View(model));
        }
Example #13
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                if ((int)Session["role"] > SessionAccessor.getUserRole(employee.Functie))
                {
                    EmployeeContainer.SaveEmployee(employee);
                    return(RedirectToAction("Index"));
                }
            }
            var model = new EmployeeModel();

            model.Employee = employee;
            model.Markets  = MarketContainer.GetMarkets();

            return(View(model));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var model = new DeliveryModel();

            model.Delivery = DeliveryContainer.getDeliveryById((int)id);
            if ((int)Session["role"] != 3)
            {
                model.Statuses.Remove("Refuzata");
            }
            model.Markets   = MarketContainer.GetMarkets();
            model.Suppliers = SupplierContainer.GetSuppliers();

            return(View(model));
        }
Example #15
0
 public ActionResult Edit(HttpPostedFileBase postedFile, ProductModel model)
 {
     if (ModelState.IsValid)
     {
         if (postedFile != null)
         {
             var filename = "img_" + model.Product.Denumire.ToLower().Replace(' ', '_') + ".png";
             var path     = Path.Combine(Server.MapPath("~/Content/ProductsImages/"), filename);
             postedFile.SaveAs(path);
             model.Product.Imagine = "img_" + model.Product.Denumire.ToLower().Replace(' ', '_');
         }
         if (model.Product.Pret > 0 && model.Product.Cantitate > 0)
         {
             ProductsContainer.SaveProduct(model.Product);
             return(RedirectToAction("Index"));
         }
     }
     model.Categories = CategoryContainer.GetCategories();
     model.Markets    = MarketContainer.GetMarkets();
     return(View(model));
 }
Example #16
0
        // GET: Suppliers
        public ActionResult Index()
        {
            var markets = MarketContainer.GetMarkets();

            return(View(markets));
        }