public ActionResult Details(int id) { if (SessionController.UserIsInSession()) { CollectionViewModel cModel = new CollectionViewModel(); cModel.User = userObj.GetUser(userId); cModel.Category = categoryObj.GetCategory(id); return(View(cModel)); } return(RedirectToAction("Index", "Login")); }
//Display movies and category name on Movies page, by selected category public ActionResult Movies(int id) { CollectionViewModel viewModel = new CollectionViewModel(); viewModel.Movies = movieObj.GetAllMoviesByCategory(id); viewModel.Category = categoryObj.GetCategory(id); return(View(viewModel)); }
public ActionResult JoinLobby(int lobbyId, int categoryId) { if (SessionLogin.UserIsInSession()) { LobbyViewModel lobbyViewModel = new LobbyViewModel(); lobbyViewModel.PlayerName = SessionLogin.UserName; lobbyViewModel.quizCategory = categoryClient.GetCategory(categoryId); lobbyViewModel.lobby = lobbyClient.GetLobby(lobbyId); lobbyViewModel.users = userClient.GetUsersInLobby(lobbyId); lobbyViewModel.user = userClient.GetUserByUsername(SessionLogin.UserName); return(View(lobbyViewModel)); } return(RedirectToAction("Index")); }
/// <summary> /// Attempts to get a category and then outputs results to console. /// </summary> /// <param name="id">The ID of the category to retrieve</param> private static void TestGetCategory(int id) { var catService = new CategoryServiceClient(); try { Console.WriteLine(string.Format("\nAttempting to retrieve category {0}.", id)); Category cat = catService.GetCategory(id); Console.WriteLine(string.Format(" - Category Retrieved: ID = {0}, Name = {1}, Description = {2}", cat.ID, cat.Name, cat.Description)); } catch (FaultException ex) { Console.WriteLine(string.Format(" - Get Exception: {0}", ex.Message)); } }
/// <summary> /// Attempts to get a category and then outputs results to console. /// </summary> /// <param name="id">The ID of the category to retrieve</param> private static void TestGetCategory(int id) { var catService = new CategoryServiceClient(); try { Console.WriteLine(string.Format("\nAttempting to retrieve category {0}.", id)); Category cat = catService.GetCategory(id); Console.WriteLine(string.Format(" - Category Retrieved: ID = {0}, Name = {1}, Description = {2}", cat.ID, cat.Name, cat.Description)); } catch (FaultException ex) { Console.WriteLine(string.Format(" - Get Exception: {0}", ex.Message)); } }