Пример #1
0
        private void Main_Load(object sender, EventArgs e)
        {
            string absolutePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Application.ExecutablePath))), @"Images\", gameBusiness.FindByName("Team Fortress 2").Image);

            pb_test.Image = Image.FromFile(absolutePath);

            List <Game> games = gameBusiness.GetAll();

            foreach (var item in games)
            {
                listBox_games.Items.Add(item.Name);
            }

            foreach (var item in games)
            {
                bool genreExists = false;

                foreach (var genre in comboBox_genre.Items)
                {
                    if ((string)genre == item.Genre)
                    {
                        genreExists = true;
                    }
                }

                if (!genreExists)
                {
                    comboBox_genre.Items.Add(item.Genre);
                }
            }
        }
Пример #2
0
        private void Main_Load(object sender, EventArgs e)
        {
            string absolutePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(Application.ExecutablePath))), @"Images\", gameBusiness.FindByName("Team Fortress 2").Image);

            pb_picture.Image = Image.FromFile(absolutePath);

            List <Game> games = gameBusiness.GetAll();

            foreach (var item in games)
            {
                listBox_games.Items.Add(item.Name);
            }

            listBox_games.SelectedItem = listBox_games.Items[0];    //sets default selected item of the listbox to the first one



            foreach (var item in games)
            {
                //fils genre filter
                bool genreExists = false;

                foreach (var genre in comboBox_genre.Items)
                {
                    if ((string)genre == item.Genre)
                    {
                        genreExists = true;
                    }
                }

                if (!genreExists)
                {
                    comboBox_genre.Items.Add(item.Genre);
                }

                //fills developer filter
                bool developerExists = false;

                foreach (var developer in comboBox_developer.Items)
                {
                    if ((string)developer == item.Developer)
                    {
                        developerExists = true;
                    }
                }

                if (!developerExists)
                {
                    comboBox_developer.Items.Add(item.Developer);
                }
            }
        }
Пример #3
0
        public void GetAll()
        {
            var gameBusiness = new GameBusiness();

            var result = gameBusiness.GetAll();

            Assert.IsNotNull(result);

            Assert.IsNotNull(result.Count > 1);
        }
Пример #4
0
        public HttpResponseMessage Get()
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.InternalServerError);

            try
            {
                GameBusiness gameBusiness = new GameBusiness();

                var result = gameBusiness.GetAll();

                response = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch (Exception e)
            {
                Logger.Error("GameController", "Get", e.Message);
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, "Unexpected error");
            }

            return response;
        }