Esempio n. 1
0
 // GET: StockItem/Edit/5
 public ActionResult Edit(int id)
 {
     using (StockItemContext stockItem = new StockItemContext())
     {
         return(View(stockItem.StockItems.Where(x => x.stkId == id).FirstOrDefault()));
     }
 }
Esempio n. 2
0
 // GET: StockItem
 public ActionResult Index()
 {
     using (StockItemContext stockItem = new StockItemContext())
     {
         return(View(stockItem.StockItems.ToList()));
     }
 }
Esempio n. 3
0
 public ActionResult DeleteSup(int id)
 {
     using (StockItemContext stockItem = new StockItemContext())
     {
         return(View(stockItem.Suppliers.Where(x => x.SupId == id).FirstOrDefault()));
     }
 }
Esempio n. 4
0
 public ActionResult DeleteUnitOfSale(int id)
 {
     using (StockItemContext stockItem = new StockItemContext())
     {
         return(View(stockItem.UnitOfSales.Where(x => x.UoSId == id).FirstOrDefault()));
     }
 }
        public StockItemsStatusController(StockItemContext context)
        {
            this.context = context;

            if (!context.StockItems.Any())
            {
                context.StockItems.Add(new StockItem()
                {
                    Id = 1, InStock = true, ProductId = 1
                });
                context.SaveChanges();
            }
        }
Esempio n. 6
0
 public ActionResult EditUnitOfSale(int id, UnitOfSale unitOfSales)
 {
     try
     {
         using (StockItemContext stockItem = new StockItemContext())
         {
             stockItem.Entry(unitOfSales).State = EntityState.Modified;
             stockItem.SaveChanges();
         }
         return(RedirectToAction("UnitOfSaleIndex"));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 7
0
 public ActionResult EditSup(int id, Supplier suppliers)
 {
     try
     {
         using (StockItemContext stockItem = new StockItemContext())
         {
             stockItem.Entry(suppliers).State = EntityState.Modified;
             stockItem.SaveChanges();
         }
         return(RedirectToAction("SupplierIndex"));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 8
0
        public ActionResult Create(StockItem StockItem)
        {
            try
            {
                using (StockItemContext stockItem = new StockItemContext())
                {
                    stockItem.StockItems.Add(StockItem);
                    stockItem.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 9
0
        public ActionResult UnitOfSaleIndex()
        {
            StockItemContext    db          = new StockItemContext();
            List <UnitOfSale>   UnitOfSales = db.UnitOfSales.ToList();
            UnitOfSaleViewModel UoSvm       = new UnitOfSaleViewModel();

            List <UnitOfSaleViewModel>
            UnitOfSaleViewModel = UnitOfSales.Select(x => new UnitOfSaleViewModel
            {
                UoSId       = x.UoSId,
                Code        = x.Code,
                Description = x.Description
            }).ToList();


            return(View(UnitOfSaleViewModel));
        }
Esempio n. 10
0
        public ActionResult CreateUnitOfSale(UnitOfSale unitOfSale)
        {
            try
            {
                using (StockItemContext stockItem = new StockItemContext())
                {
                    stockItem.UnitOfSales.Add(unitOfSale);
                    stockItem.SaveChanges();
                }

                return(RedirectToAction("UnitOfSaleIndex"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 11
0
        public ActionResult CreateSup(Supplier supplier)
        {
            try
            {
                using (StockItemContext stockItem = new StockItemContext())
                {
                    stockItem.Suppliers.Add(supplier);
                    stockItem.SaveChanges();
                }

                return(RedirectToAction("SupplierIndex"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 12
0
        public ActionResult DeleteUnitOfSale(int id, FormCollection collection)
        {
            try
            {
                using (StockItemContext stockItemContext = new StockItemContext())
                {
                    UnitOfSale unitOfSale = stockItemContext.UnitOfSales.Where(x => x.UoSId == id).FirstOrDefault();
                    stockItemContext.UnitOfSales.Remove(unitOfSale);
                    stockItemContext.SaveChanges();
                }

                return(RedirectToAction("UnitOfSaleIndex"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 13
0
        public ActionResult DeleteSup(int id, FormCollection collection)
        {
            try
            {
                using (StockItemContext stockItemContext = new StockItemContext())
                {
                    Supplier suppliers = stockItemContext.Suppliers.Where(x => x.SupId == id).FirstOrDefault();
                    stockItemContext.Suppliers.Remove(suppliers);
                    stockItemContext.SaveChanges();
                }

                return(RedirectToAction("SupplierIndex"));
            }
            catch
            {
                return(View());
            }
        }
Esempio n. 14
0
        public ActionResult SupplierIndex()
        {
            StockItemContext  db        = new StockItemContext();
            List <Supplier>   Suppliers = db.Suppliers.ToList();
            SupplierViewModel spvm      = new SupplierViewModel();

            List <SupplierViewModel>
            SupplierViewModel = Suppliers.Select(x => new SupplierViewModel
            {
                SupId       = x.SupId,
                Code        = x.Code,
                Description = x.Description,
                CostPrice   = x.CostPrice
            }).ToList();


            return(View(SupplierViewModel));
        }