//Gamelist updated depending on list option change public void ChooseList(object sender) { switch (sender) { case "0": Label = "All Games"; var a = GamesSource.SelectAll(); Games = new ObservableCollection <IGameDetailsModel>(a); break; case "1": Label = "Played Games"; var b = GamesSource.SelectAll().Where(x => x.GetStatus == GameDetailsModel.Status.Played).ToList(); Games = new ObservableCollection <IGameDetailsModel>(b); break; case "2": Label = "Playing Games"; var c = GamesSource.SelectAll().Where(x => x.GetStatus == GameDetailsModel.Status.Playing).ToList(); Games = new ObservableCollection <IGameDetailsModel>(c); break; case "3": Label = "Not Played Games"; var d = GamesSource.SelectAll().Where(x => x.GetStatus == GameDetailsModel.Status.Not_Played).ToList(); Games = new ObservableCollection <IGameDetailsModel>(d); break; case "4": Label = "Upcoming Games"; var e = GamesSource.SelectAll().Where(x => x.FirstReleaseDate >= Convert.ToInt64((DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds)).ToList(); Games = new ObservableCollection <IGameDetailsModel>(e); break; default: MessageBox.Show("Pick List"); break; } }
public AddGamePageViewModel() { //Unity Initialization container = new UnityContainer(); UnityRegister.Register(container); GameSource = container.Resolve <ISqlConnectionInjector <IGameDetailsModel> >(); PlatformSource = container.Resolve <ISqlConnectionInjector <IPlatformModel> >(); //Command Initialization DetailsCommand = new RelayCommand(new Action <object>(ShowDetails)); AddCommand = new RelayCommand(new Action <object>(AddGame)); SearchCommand = new RelayCommand(new Action <object>(SearchGames)); //Assign Platforms Platforms = new ObservableCollection <IPlatformModel>(PlatformSource.SelectAll()); DataContext = this; }
public MainViewModel() { //Unity Injection. container = new UnityContainer(); UnityRegister.Register(container); viewContainer = new UnityContainer(); UnityResolver.Register(viewContainer); GamesSource = container.Resolve <ISqlConnectionInjector <IGameDetailsModel> >(); SalesChecker s = new SalesChecker(); Games = new ObservableCollection <IGameDetailsModel>(GamesSource.SelectAll()); SalesCommand = new RelayCommand(new Action <object>(ShowSales)); SearchCommand = new RelayCommand(new Action <object>(SearchGame)); QuitAppCommand = new RelayCommand(new Action <object>(QuitApp)); GameDetailsCommand = new RelayCommand(new Action <object>(ShowGameDetails)); DeleteGameCommand = new RelayCommand(new Action <object>(DeleteGame)); MoveItemRightCommand = new RelayCommand(new Action <object>(ShowGameDetails)); EnterCommand = new RelayCommand(new Action <object>(ShowGameDetails)); ExportList = new RelayCommand(new Action <object>(ExportGameList)); DataContext = this; }
/// <summary> /// Get list of records from the source database with the same name as paramater's name. /// </summary> /// <param name="name"></param> /// <returns></returns> public List <GameModel> GetBy(GameModel name) { var gamesList = _mapper.Map <List <IGameDetailsModel>, List <GameModel> >(_sqlConn.SelectAll()); return((List <GameModel>)gamesList.Where(x => x.Name.Contains(name.Name))); }
public List <Models.PlatformModel> GetAll() { return(_mapper.Map <List <IPlatformModel>, List <Models.PlatformModel> >(_sqlConn.SelectAll())); }