Пример #1
0
        public ActionResult Create(Event event1)
        {
            if (ModelState.IsValid)
            {
                db.Events.Add(event1);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(event1);
        }
        public ActionResult Create(Event event1)
        {
            if (ModelState.IsValid)
            {
                event1.UserName = Session["UserName"].ToString();
                db.Events.Add(event1);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(event1);
        }
 public ActionResult Edit(Event event1)
 {
     if (ModelState.IsValid)
     {
         db.Entry(event1).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(event1);
 }