public IActionResult DeleteConfirmed(int id) { var manufacturer = _manufacturerRepository.GetById(id); _manufacturerRepository.Remove(manufacturer); return(RedirectToAction(nameof(Index))); }
public ActionResult Delete(int id) { repo.Remove(repo.Get(id)); repo.SaveChanges(); int redirectPage = (int)Session["LastPage"]; return(RedirectToAction("Index", new { id = redirectPage })); }
public void Delete(Guid id) { var manufacturerEntity = manufacturerRepository.GetById(id); manufacturerEntity.Product = productRepository.GetByManufacturerId(id); foreach (var product in manufacturerEntity.Product) { product.ManufacturerId = Guid.Empty; product.Manufacturer = null; } manufacturerRepository.Remove(id); }