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

            db.Products.Remove(productModel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo 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"));
        }
Exemplo n.º 3
0
 private void Save()
 {
     invoiceDbContext.SaveChanges();
 }