public ActionResult Edit(Game game) { if (ModelState.IsValid) { db.Entry(game).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } UserHandler userHandler = new UserHandler(); UserProfileInfo user = userHandler.GetUserLogged(); GameHandler GameHandler = new GameHandler(); ViewBag.GameSerieID = GameHandler.SelectGameSeries(user, game); ViewBag.Players = new SelectList(user.Groups .Where(i => i.DominoesGroupID == user.GroupAdministered) .Select(i => i.Users).First(), "UserProfileInfoID", "FirstName"); return View(game); }
// GET: Games/Edit/5 public ActionResult Edit(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } UserHandler userHandler = new UserHandler(); UserProfileInfo user = userHandler.GetUserLogged(); Game game = db.Game.Find(id); if (game == null) { return HttpNotFound(); } GameHandler GameHandler = new GameHandler(); ViewBag.GameSerieID = GameHandler.SelectGameSeries(user, game); ViewBag.Players = new SelectList(user.Groups .Where(i => i.DominoesGroupID == user.GroupAdministered) .Select(i => i.Users).First(), "UserProfileInfoID", "FirstName"); return View(game); }