public IActionResult ShowsBrand() { ShowBrandEdit showBrandEdit = new ShowBrandEdit() { brands = _context.brands.Include(e => e.manufacturer).Include(e => e.type_of_avto), manufacturers = _context.manufacturers, type_Of_Avtos = _context.type_of_avto }; return(View(showBrandEdit)); }
public IActionResult ShowsBrand(int id, string action, string manfilt, string typeFilt) { if (manfilt != null) { ShowBrandEdit showBrandEdit = new ShowBrandEdit() { brands = _context.brands.Include(e => e.manufacturer).Include(e => e.type_of_avto).Where(e => e.manufacturer.name == manfilt), manufacturers = _context.manufacturers, type_Of_Avtos = _context.type_of_avto }; return(View(showBrandEdit)); } if (typeFilt != null) { ShowBrandEdit showBrandEdit = new ShowBrandEdit() { brands = _context.brands.Include(e => e.manufacturer).Include(e => e.type_of_avto).Where(e => e.type_of_avto.name == typeFilt), manufacturers = _context.manufacturers, type_Of_Avtos = _context.type_of_avto }; return(View(showBrandEdit)); } if (action == "Delete") { var delItem = _context.brands.Where(e => e.brand_key == id).FirstOrDefault(); _context.brands.Remove(delItem); _context.SaveChanges(); IEnumerable <brand> brands = _context.brands.Include(e => e.manufacturer).Include(e => e.type_of_avto); return(View(brands)); } else if (action == "Edit") { return(RedirectToAction("EditBrand", "Edit", new { id = id })); } return(View()); }