public ActionResult DeleteConfirmed(int id) { CarSalon carSalon = db.CarSalon.Find(id); db.CarSalon.Remove(carSalon); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,PIB,Name,Country,City,Address")] CarSalon carSalon) { if (ModelState.IsValid) { db.Entry(carSalon).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(carSalon)); }
public ActionResult Create([Bind(Include = "Id,PIB,Name,Country,City,Address")] CarSalon carSalon) { if (ModelState.IsValid) { db.CarSalon.Add(carSalon); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(carSalon)); }
// GET: CarSalons/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CarSalon carSalon = db.CarSalon.Find(id); if (carSalon == null) { return(HttpNotFound()); } return(View(carSalon)); }
// GET: CarSalons/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CarSalon carSalon = db.CarSalon.Find(id); SalonListsCarsContractsViewModel vm = new SalonListsCarsContractsViewModel(); vm.CarSalons = carSalon; vm.ListCars = db.Cars.Include(c => c.Manufacturer).Where(m => m.CarSalonId == id).ToList(); vm.ListContracts = db.Contract.Where(m => m.CarSalonId == id).ToList(); if (carSalon == null) { return(HttpNotFound()); } return(View(vm)); }