Esempio n. 1
0
 public ActionResult Edit(Events events)
 {
     if (ModelState.IsValid)
     {
         db.Entry(events).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.StatusID = new SelectList(db.Status, "StatusID", "status", events.StatusID);
     ViewBag.TypeID = new SelectList(db.Types, "TypeID", "type", events.TypeID);
     return View(events);
 }
Esempio n. 2
0
        public ActionResult Create(Events events)
        {
            if (ModelState.IsValid)
            {
                events.Createuser = Session["username"].ToString();
                events.StatusID= 5 ;
                db.Events.Add(events);
                db.SaveChanges();
                if (Session["identify"].Equals("admin"))
                {
                    return RedirectToAction("Index");
                }
                else
                {
                    Session["thisid"] = events.E_ID;
                    return RedirectToAction("IndexforUser");
                }
            }

            ViewBag.StatusID = new SelectList(db.Status, "StatusID", "status", events.StatusID);
            ViewBag.TypeID = new SelectList(db.Types, "TypeID", "type", events.TypeID);
            return View(events);
        }