Esempio n. 1
0
 //
 // 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);
 }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 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);
 }