public void Post([FromBody] Shopping shopping)
        {
            string             result     = string.Empty;
            ShoppingRepository repository = new ShoppingRepository();

            result = repository.DeleteShoppingById(shopping.Id_Trolley);
        }
        public void Delete(int id)
        {
            string             result     = string.Empty;
            ShoppingRepository repository = new ShoppingRepository();

            result = repository.DeleteShoppingById(id);
        }
        public void Post([FromBody] ShoppingPay shoppingPays)
        {
            string             result     = string.Empty;
            ShoppingRepository repository = new ShoppingRepository();

            result = repository.ShoppingPays(shoppingPays);
        }
Пример #4
0
        static void Main(string[] args)
        {
            var shoppingRepository = new ShoppingRepository();
            var shoppingOperation  = new ShoppingOperation(shoppingRepository);

            Console.WriteLine("Welcome to Retail Shop... Happy Shopping");
            var availableProducts = shoppingOperation.AddProducts();

            Console.WriteLine("------Product--------Price-------");
            foreach (var product in availableProducts)
            {
                Console.WriteLine($"        {product.Name}           {product.Price}");
            }

            Console.WriteLine("Please Enter Cart Items");
            var inputItems = Console.ReadLine();
            var cartItems  = shoppingOperation.ProcessCartItems(inputItems);

            var productDetails = shoppingOperation.GetProductDetails(cartItems, availableProducts);

            var total = shoppingOperation.GetTotalBill(productDetails);

            Console.WriteLine("-------Qunatity * Product------ Price----");
            foreach (var item in productDetails)
            {
                Console.WriteLine($"-------{item.Quantity} * {item.Product} ----- {item.Price}-----");
            }

            Console.WriteLine($"-------Total --------------{total}-------");
            Console.ReadLine();
        }
        public List <Shopping> GetShopping(string id)
        {
            List <Shopping>    lstShopping = new List <Shopping>();
            ShoppingRepository repository  = new ShoppingRepository();

            lstShopping = repository.GetShoppingByIdUser(id);

            return(ShoppingActions.SearchProductBuys(lstShopping));
        }
Пример #6
0
        public void OnNavigatedTo(NavigationParameters parameters)
        {
            ShoppingRepository fooShoppingRepository = new ShoppingRepository();
            var fooShoppingItemList = fooShoppingRepository.GetShoppingItem();

            foreach (var item in fooShoppingItemList)
            {
                ShoppingItemList.Add(new ShoppingItem
                {
                    Name  = item.Name,
                    Price = item.Price,
                    Qty   = item.Qty,
                });
            }
        }
Пример #7
0
        public static List <Shopping> SearchProductBuys(List <Shopping> lstProducts)
        {
            List <Shopping> lstShopping = new List <Shopping>();

            foreach (var item in lstProducts)
            {
                ShoppingRepository repository = new ShoppingRepository();
                List <Shopping>    lstBuys    = new List <Shopping>();
                lstBuys = repository.GetShoppingByIdUserAndTrolley(item.Id_Trolley);


                if (repository.GetShoppingByIdUserAndTrolley(item.Id_Trolley).Count == 0)
                {
                    lstShopping.Add(item);
                }
            }
            return(lstShopping);
        }
Пример #8
0
        public void GetBasketNullParamsTest()
        {
            // Arrange
            var service = new Mock <ShoppingService>();

            service.Setup(m => m.GetBasket(1, null, null, null)).Returns(new Basket());

            var client = new Mock <IAccessClient>();

            client.Setup(m => m.ShoppingProxy).Returns(service.Object);

            // Act
            var repo   = new ShoppingRepository(client.Object);
            var result = repo.GetBasket(1, null, null, null);

            // Assert
            Assert.IsNotNull(result);
        }
Пример #9
0
 public ShoppingService()
 {
     shoppingRepository = new ShoppingRepository();
 }