Example #1
0
 public Game(int productId, string productName, decimal price, int stock, ProductType type,
             GamesStorageDataDevices gamesStorageDataDevices, GamesPlatforms platform, GamesCategory category)
     : base(productId, productName, price, stock, type)
 {
     this.DataStorageDevice = gamesStorageDataDevices;
     this.Platform          = platform;
     this.category          = category;
 }
        private static Product CreateGame(int id,
                                          string name,
                                          decimal price,
                                          int stock,
                                          ProductType type,
                                          Dictionary <String, String> attributes)
        {
            GamesStorageDataDevices dataDevices = (GamesStorageDataDevices)Enum.Parse(typeof(GamesStorageDataDevices),
                                                                                      attributes["GamesStorageDataDevices"]);
            GamesPlatforms platform = (GamesPlatforms)Enum.Parse(typeof(GamesPlatforms), attributes["GamesPlatform"]);
            GamesCategory  category = (GamesCategory)Enum.Parse(typeof(GamesCategory), attributes["GamesCategory"]);

            return(new Game(id, name, price, stock, type, dataDevices, platform, category));
        }
Example #3
0
        public void Filter()
        {
            // This could break the test if the pop up si not present
            // Check presence
            if (IsElementPresent(By.Id("closefloatingbox")))
            {
                PopupCloseButton.Click();
            }

            MoviesCategory.Click();
            GamesCategory.Click();
            OthersCategory.Click();
            MusicCategory.Click();
            SoftwareCategory.Click();
            SportCategory.Click();
            RussianFilmsCategory.Click();
        }
Example #4
0
 public void Category(GamesCategory category)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public IActionResult AllSearches(string location, string price, string sportType)
 {
     if (!location.Contains("All"))
     {
         playgrounds = playgrounds.Where(p => p.Location == location).ToList();
         trainers    = trainers.Where(p => p.Location == location).ToList();
         gyms        = gyms.Where(p => p.Location == location).ToList();
     }
     if (!sportType.Contains("All"))
     {
         GamesCategory e = (GamesCategory)Enum.Parse(typeof(GamesCategory), sportType);
         playgrounds = playgrounds.Where(p => p.SportType == e).ToList();
         trainers    = trainers.Where(p => p.SportType == e).ToList();
         gyms        = gyms.Where(p => p.SportType == e).ToList();
     }
     if (!price.Contains("All"))
     {
         string[] numbers          = Regex.Split(price, @"\D+");
         var      startPrice       = 0;
         var      toPrice          = 0;
         var      playgroundPrices = new List <string>(); //all playgrounds Id
         var      gymPrices        = new List <string>(); //all gyms Id
         if (price.Contains("Under"))
         {
             startPrice       = int.Parse(numbers[1]);
             playgroundPrices = _context.playgroundPrices.Where(p => p.Price < startPrice).Select(p => p.PlaygroundId).Distinct().ToList();
             gymPrices        = _context.GymPrices.Where(g => g.Subscribtion_Price < startPrice).Select(g => g.GymId).Distinct().ToList();
         }
         else if (price.Contains("Over"))
         {
             startPrice       = int.Parse(numbers[1]);
             playgroundPrices = _context.playgroundPrices.Where(p => p.Price > startPrice).Select(p => p.PlaygroundId).Distinct().ToList();
             gymPrices        = _context.GymPrices.Where(g => g.Subscribtion_Price > startPrice).Select(g => g.GymId).Distinct().ToList();
         }
         else
         {
             startPrice       = int.Parse(numbers[0]);
             toPrice          = int.Parse(numbers[1]);
             playgroundPrices = _context.playgroundPrices.Where(p => p.Price >= startPrice && p.Price <= toPrice).Select(p => p.PlaygroundId).Distinct().ToList();
             gymPrices        = _context.GymPrices.Where(g => g.Subscribtion_Price >= startPrice && g.Subscribtion_Price <= toPrice).Select(g => g.GymId).Distinct().ToList();
         }
         for (int i = 0; i < playgrounds.Count; i++)
         {
             var check = playgroundPrices.Contains(playgrounds[i].Id);
             if (check == false)
             {
                 playgrounds.Remove(playgrounds[i]);
                 i--;
             }
         }
         for (int i = 0; i < gyms.Count; i++)
         {
             var check = gymPrices.Contains(gyms[i].Id);
             if (check == false)
             {
                 gyms.Remove(gyms[i]);
                 i--;
             }
         }
     }
     searchVM.Playgrounds = playgrounds;
     searchVM.Gyms        = gyms;
     searchVM.Trainers    = trainers;
     return(PartialView("_SearchResult", searchVM));
 }