public JsonResult Games(String function, GameTypeViewModel game) { if (account.IsAdministrator()) { GameType gameType = new GameType(service); switch (function) { case "add": status = gameType.Create(game); break; case "delete": status = gameType.Delete(game); break; } gameType.Retrieve(); message = "Was able to " + function + " " + (status ? "successfully" : "unsuccessfully"); data = new { games = gameType.Games.Select(x => new { x.GameTypeID, x.Title }).ToList() }; } return(BundleJson()); }