public JsonResult UpdateGame(string gamename, string description, int gameid) { using (var gamerepo = new GameRepository()) { var result = gamerepo.UpdateGame(gamename, description, gameid); return new JsonResult { Data = new { isOk = result } }; } }
public JsonResult DeleteGame(int id) { using (var gamerepo = new GameRepository()) { var result = gamerepo.DeleteGame(id); return new JsonResult { Data = new { isOk = result } }; } }
public JsonResult AddGame(string gamename, string description) { using (var gamerepo = new GameRepository()) { var result = gamerepo.AddGame(gamename, description); return new JsonResult { Data = new { isOk = result } }; } }
public ActionResult ViewGameList() { using (var gamerepo = new GameRepository()) { var model = new GameViewModel(); model.Games = gamerepo.ViewGames(); return View(model); } }
public ActionResult EditGame(int id) { using (var gamerepo = new GameRepository()) { var model = new GameEditModel(); model.Game = gamerepo.GetGameById(id); return View(model); } }