// // GET: /AdminPress/Create public ActionResult Create() { ViewBag.CategoryId = new SelectList(db.PressCategories, "Id", "Name"); CreateFrame(title); var press = new Press(); press.CreatedDate = DateTime.Now; press.Active = true; return View(press); }
public ActionResult Create(Press press) { this.ValidateRequest = false; if (ModelState.IsValid) { db.Press.Add(press); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CategoryId = new SelectList(db.PressCategories, "Id", "Name", press.CategoryId); CreateFrame(title); return View(press); }
public ActionResult Edit(Press press) { this.ValidateRequest = false; if (ModelState.IsValid) { db.Entry(press).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CategoryId = new SelectList(db.PressCategories, "Id", "Name", press.CategoryId); return View(press); }