public ActionResult Create(Game game) { if (ModelState.IsValid) { game.OwnerId = WebSecurity.CurrentUserId; game.DateCreated = DateTime.Now; db.Games.Add(game); db.SaveChanges(); return RedirectToAction("Index"); } return View(game); }
private bool EditAllowed(Game g) { return g.OwnerId == WebSecurity.CurrentUserId; }
public ActionResult Edit(Game game) { if (ModelState.IsValid) { db.Entry(game).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(game); }