Exemplo 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);
 }
Exemplo 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);
        }
Exemplo 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);
 }