public IActionResult DeleteCustomer(int id) { Customer c = _context.customers.SingleOrDefault(x => x.customerid == id); _context.Remove(c); _context.SaveChanges(); return(RedirectToAction("Customers")); }
public void DeleteSubCategorie(SubCategorie subCategorie) { if (subCategorie == null) { throw new ArgumentNullException(nameof(subCategorie)); } _context.Remove(subCategorie); }
public IActionResult RemoveCmt(int cmtid, int productid) { int? id = HttpContext.Session.GetInt32("Id"); comments removecmt = _context.comments.Where(x => x.id == cmtid).FirstOrDefault(); _context.Remove(removecmt); _context.SaveChanges(); return(RedirectToAction("productinfo", new{ productid = productid })); }
public bool DeleteProduct(int id) { var pro = _db.products.Where(x => x.productId == id).FirstOrDefault(); try { _db.Remove(pro); _db.SaveChanges(); return(true); } catch { return(false); } }
public bool DeleteDepartment(int id) { var dep = _db.departments.Where(x => x.departmentId == id).FirstOrDefault(); try { _db.Remove(dep); _db.SaveChanges(); return(true); } catch { return(false); } }
public void Delete(TEntity entity) { _context.Remove(entity); }