public void RemoveDealership(DealershipDetailsViewModel entity) { Dealership dealership = context.Dealerships.Find(entity.DealershipId); context.Dealerships.Remove(dealership); context.SaveChanges(); }
public IActionResult Delete(int id) { Dealership dealership = service.GetOneDealership(id); DealershipDetailsViewModel model = new DealershipDetailsViewModel { DealershipId = dealership.DealershipId, Name = dealership.Name, Country = dealership.Country, Town = dealership.Town, Cars = dealership.Cars }; return(View(model)); }
public IActionResult Delete(DealershipDetailsViewModel entity) { service.RemoveDealership(entity); return(Redirect("/")); }