コード例 #1
0
        public ActionResult Create(Event @event)
        {
            if (ModelState.IsValid)
            {
                @event.ApplicationUserId = User.Identity.GetUserId();
                db.Events.Add(@event);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(@event);
        }
コード例 #2
0
 public ActionResult Edit(Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(@event);
 }