コード例 #1
0
 public ActionResult Billing(Billing billing, string ClientName, string ProductName)
 {
     if (ModelState.IsValid)
     {
         using (var Data = new SystemModelContainer())
         {
             Data.CreateBill(ClientName, ProductName, billing.Quantity, billing.TotalPrice, DateTime.Now);
             Data.SaveChanges();
         }
     }
     return(RedirectToAction("Billing"));
 }
コード例 #2
0
 public ActionResult Index(Stock stock)
 {
     if (ModelState.IsValid)
     {
         using (var Data = new SystemModelContainer())
         {
             Data.StockCheck(stock.Quantity, stock.Product, stock.Provider, DateTime.Now);
             Data.SaveChanges();
         }
     }
     return(RedirectToAction("Index"));
 }
コード例 #3
0
 public ActionResult Index([Bind(Include = "Id,Name,Price")] Products products)
 {
     if (ModelState.IsValid)
     {
         Database.Products.Add(products);
         Database.SaveChanges();
         using (var Data = new SystemModelContainer())
         {
             Data.StoreInfo("Se ha agregado el producto: " + products.Name + " (#" + products.Id + ").", DateTime.Now);
             Data.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     return(View(products));
 }
コード例 #4
0
        public ActionResult Index([Bind(Include = "Id,RNC,Name,Phone,Email")] Providers providers)
        {
            if (ModelState.IsValid)
            {
                Database.Providers.Add(providers);
                Database.SaveChanges();
                using (var Data = new SystemModelContainer())
                {
                    Data.StoreInfo("Se ha agregado el proveedor: " + providers.Name + " (" + providers.RNC + ").", DateTime.Now);
                    Data.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }

            return(View(providers));
        }
コード例 #5
0
        public ActionResult Index([Bind(Include = "Id,RNC,Name,Phone,Email,Category")] Clients clients)
        {
            if (ModelState.IsValid)
            {
                Database.Clients.Add(clients);
                Database.SaveChanges();
                using (var Data = new SystemModelContainer())
                {
                    Data.StoreInfo("Se ha agregado el cliente: " + clients.Name + " (" + clients.RNC + ").", DateTime.Now);
                    Data.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }

            // Audits Saved to the Database
            ViewBag.ElementID = Request.Form["RNC"];

            return(View(clients));
        }