public async Task <IActionResult> Delete(int?id) { Employee employee = await _context.Employees.FindAsync(id); _context.Remove(employee); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { Customer customer = _container.customers.Find(id); if (customer != null) { _container.Remove(customer); _container.SaveChanges(); TempData["Success"] = "Delete Customer Successed!"; return(RedirectToAction("index")); } else { TempData["Error"] = "This Customer Not Found!"; return(RedirectToAction("index")); } }