예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            CarSalon carSalon = db.CarSalon.Find(id);

            db.CarSalon.Remove(carSalon);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 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));
 }
예제 #3
0
        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));
        }
예제 #4
0
        // 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));
        }
예제 #5
0
        // 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));
        }