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