protected GameViewModel GetTestGameViewModel(int id = 0) { var viewModel = new GameViewModel { GameId = id, Title = "A really cool game", Description = "Seriously, this is an awesome game" }; return viewModel; }
/// <summary> /// Get an event view model for testing purposes /// </summary> /// <param name="id">The id of the view model (default = 0)</param> protected EditEventViewModel GetTestEventViewModel(int id = 0) { //People var theHost = new PersonViewModel { PersonId = 1 }; var guestOne = new PersonViewModel{ PersonId = 2 }; var guestTwo = new PersonViewModel { PersonId = 3 }; var theInvitees = new List<PersonViewModel> { guestOne, guestTwo }; //Food var burgers = new FoodItemViewModel { FoodItemId = 1, Title = "Hambergers", Description = "Apple bacon smoked burgers for 10 people." }; var coke = new FoodItemViewModel { FoodItemId = 2, Title = "Coke", Description = "Two 6 packs" }; var cheese = new FoodItemViewModel { FoodItemId = 3, Title = "Cheese", Description = "Good with crackers" }; var foodForTheParty = new List<FoodItemViewModel> { coke, cheese }; //Games var settlers = new GameViewModel { GameId = 1, Title = "Settlers of Catan", Description = "The best game ever for up to four people" }; var blockus = new GameViewModel { GameId = 2, Title = "Blockus", Description = "Fun game of shape fitting for up four people." }; var gamesForTheParty = new List<GameViewModel> { settlers,blockus }; var viewModel = new EditEventViewModel { EventId = id, Title = "My Test Event", Description = "This is a fun test event", Location = "My House", StartDate = DateTime.Now, StartTime = "5:00 PM", EndTime = "2:00 AM", WillBringTheseFoodItems = foodForTheParty, WillBringTheseGames = gamesForTheParty, PeopleInvited = theInvitees }; return viewModel; }
/// <summary> /// Get a list of all games that are associated with the event that no one is bringing yet. /// </summary> /// <param name="eventGameIds">A list of all game ids that are associated with the event</param> /// <param name="personGameIds">A list of all game ids that a person is bringing personally</param> /// <param name="eventId">an event id</param> /// <returns></returns> private List<GameViewModel> GetNonSelectedGames(List<int> eventGameIds, List<int> personGameIds, int eventId) { var gameList = new List<GameViewModel>(); var selectedGamesIds = personGameIds.Where(x => !eventGameIds.Contains(x)); var remainingGames = _gameRepository.GetAll() .Where(x => selectedGamesIds.Contains(x.GameId)) .OrderBy(x => x.Title).ToList(); remainingGames.ForEach(x => { var viewModel = new GameViewModel(x); viewModel.Index = remainingGames.IndexOf(x); viewModel.EventId = eventId; gameList.Add(viewModel); }); return gameList; }