Example #1
0
        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);
        }
Example #2
0
 private bool EditAllowed(Game g)
 {
     return g.OwnerId == WebSecurity.CurrentUserId;
 }
Example #3
0
 public ActionResult Edit(Game game)
 {
     if (ModelState.IsValid)
     {
         db.Entry(game).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(game);
 }