Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ProductModel productModel = db.Products.Find(id);

            db.Products.Remove(productModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ActionResult Delete(int id)
        {
            var invoice = db.Invoices.Include(x => x.CustomerModel)
                          .Include(x => x.Products)
                          .Include("Products.Product")
                          .FirstOrDefault(x => x.Id == id);

            db.Invoices.Remove(invoice);
            db.SaveChanges();
            return(RedirectToAction("Index", "Invoice"));
        }
Esempio n. 3
0
 private void Save()
 {
     invoiceDbContext.SaveChanges();
 }