Esempio n. 1
0
        static UserAPIController()
        {
            var ran    = new Random();
            var images = new List <string>()
            {
                @"https://images.samsung.com/is/image/samsung/p5/ru/smartphones/PCD_Purple.png?$ORIGIN_PNG$",
                @"https://drop.ndtv.com/TECH/product_database/images/6142017123101PM_635_htc_desire_628_dual_sIM.jpeg",
                @"https://akket.com/wp-content/uploads/2018/04/Nokia-9-42.jpg",
                @"https://3dnews.ru/assets/external/illustrations/2018/03/16/967085/sm.x1.750.jpg"
            };
            var Products = new List <Product>();
            var brannds  = ProductAPIController.GetBrands();

            foreach (var item in items)
            {
                var product = new Product()
                {
                    Name  = brannds[ran.Next(0, 4)] + " " + item,
                    Price = ran.Next(1000, 10000),
                    //Image = images[ran.Next(0, 4)],
                    Quantity = 5,
                    Brand    = item
                };
                Products.Add(product);
            }

            UserDataBase = new Dictionary <string, UserModel>();
            UserDataBase.Add("Argishty", new UserModel("Argishty", "Ayavzyan", "738274928", "Yerevan", "argishta", "12345", "aps.gmail.com", 1));
            SellerDataBase = new Dictionary <int, Seller>();
            var index = 0;

            for (var i = 1; i < 5; ++i)
            {
                var seller = new Seller()
                {
                    Id        = i,
                    Name      = $"Mobile Centr{i}",
                    Address   = $"Yerevan{i}",
                    Rating    = 3.4m,
                    CellPhone = "+(374) 94047454",
                    Email     = "*****@*****.**"
                };


                SellerDataBase.Add(i, seller);
                ProductAPIController.AddProduct(seller.Id, Products[index++]);
                ProductAPIController.AddProduct(seller.Id, Products[index++]);
                ProductAPIController.AddProduct(seller.Id, Products[index++]);
            }
        }
Esempio n. 2
0
 public static IEnumerable <Product> GetAllProducts()
 {
     return(CartDataBase.Select(id => ProductAPIController.GetProductById(id).Result));
 }
Esempio n. 3
0
 public static IEnumerable <Product> GetProductsBySellerId(int sellerId)
 {
     return(CatalogDataBase[sellerId].Select(id => ProductAPIController.GetProductById(id).Result));
 }