Esempio n. 1
0
 //
 // GET: /AdminDealer/Create
 public ActionResult Create()
 {
     ViewBag.AreaId = new SelectList(db.Area, "Id", "Name");
     CreateFrame(title);
     var dealer = new Dealer();
     dealer.Active = true;
     return View(dealer);
 }
Esempio n. 2
0
        public ActionResult Create(Dealer dealer)
        {
            if (ModelState.IsValid)
            {
                db.Dealer.Add(dealer);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.AreaId = new SelectList(db.Area, "Id", "Name", dealer.AreaId);
            CreateFrame(title);
            return View(dealer);
        }
Esempio n. 3
0
 public ActionResult Edit(Dealer dealer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dealer).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.AreaId = new SelectList(db.Area, "Id", "Name", dealer.AreaId);
     return View(dealer);
 }