// // GET: /AdminDealer/Create public ActionResult Create() { ViewBag.CategoryId = new SelectList(db.CaseCategory, "Id", "Name"); CreateFrame(title); var item = new Case(); item.Active = true; return View(item); }
public ActionResult Create(Case item) { if (ModelState.IsValid) { db.Case.Add(item); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CategoryId = new SelectList(db.CaseCategory, "Id", "Name", item.CategoryId); CreateFrame(title); return View(item); }
public ActionResult Edit(Case item) { if (ModelState.IsValid) { db.Entry(item).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CategoryId = new SelectList(db.CaseCategory, "Id", "Name", item.CategoryId); return View(item); }