public IActionResult DeleteConfirmed(int id)
        {
            var manufacturer = _manufacturerRepository.GetById(id);

            _manufacturerRepository.Remove(manufacturer);
            return(RedirectToAction(nameof(Index)));
        }
Esempio n. 2
0
        public ActionResult Delete(int id)
        {
            repo.Remove(repo.Get(id));
            repo.SaveChanges();

            int redirectPage = (int)Session["LastPage"];

            return(RedirectToAction("Index", new { id = redirectPage }));
        }
Esempio n. 3
0
        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);
        }