コード例 #1
0
 public ActionResult Create(Event events)
 {
     events.Author = db.GetUserFromMember(Membership.GetUser()).DisplayName;
     events.AuthorID = db.GetUserFromMember(Membership.GetUser()).Id;
     db.Events.Add(events);
     db.SaveChanges();
     return RedirectToAction("Index");
 }
コード例 #2
0
 public ActionResult Edit(Event events)
 {
     if (ModelState.IsValid)
     {
         db.Entry(events).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(events);
 }