Exemplo n.º 1
0
 public void DeleteProduct(Food food)
 {
     if (BaseConsoleFunction.CheckArea($"You want delete {food} ? y/n", "y"))
     {
         _foodService.DeleteFood(food);
         BaseConsoleFunction.GetProperty($"This product: {food} was deleted");
     }
 }
Exemplo n.º 2
0
        public void CreateNewProduct()
        {
            Console.Clear();
            var name   = BaseConsoleFunction.GetProperty("Enter product name");
            var price  = Checker.GetPropertyDecimal(BaseConsoleFunction.GetProperty("Enter price"));
            var weight = Checker.GetPropertyFloat(BaseConsoleFunction.GetProperty("Enter weight"));
            var type   = BaseConsoleFunction.GetProperty("Enter type");

            if (BaseConsoleFunction.CheckArea("Want to confirm your actions? y/n", "y"))
            {
                var food = _foodService.CreateFood(name, price, weight, type);
                Console.WriteLine($"{food} was created!");
                Console.ReadLine();
            }
        }
Exemplo n.º 3
0
        public void UpdateProduct(Food food)
        {
            var name = (BaseConsoleFunction.CheckArea($"You want update name ? y/n", "y")?
                        BaseConsoleFunction.GetProperty("Enter new name")
                : food.Name);
            var price = (BaseConsoleFunction.CheckArea($"You want update price ? y/n", "y") ?
                         Checker.GetPropertyDecimal(BaseConsoleFunction.GetProperty("Enter new price"))
                : food.Price);
            var weight = (BaseConsoleFunction.CheckArea($"You want update weight ? y/n", "y") ?
                          Checker.GetPropertyFloat(BaseConsoleFunction.GetProperty("Enter new weight"))
                : food.Weight);
            var type = (BaseConsoleFunction.CheckArea($"You want update type ? y/n", "y") ?
                        BaseConsoleFunction.GetProperty("Enter new type")
                : food.Type.Name);

            if (BaseConsoleFunction.CheckArea($"You want update {food} ? y/n", "y"))
            {
                var newFood = _foodService.UpdateFood(food, name, price, weight, type);
                BaseConsoleFunction.GetProperty($"This product: {newFood} was updated");
            }
        }
Exemplo n.º 4
0
        private void CreateOrder()
        {
            var items = _basketController.GetBasketItems();

            if (items.Any())
            {
                BaseConsoleFunction.WithdrawList(items.ToArray());
                if (BaseConsoleFunction.CheckArea("Want to issue a order ? y/n", "y"))
                {
                    var phoneNumber = Checker.GetPropertyPhoneNumber(BaseConsoleFunction.GetProperty("Enter phone"));
                    var street      = Checker.GetPropertyStreet(BaseConsoleFunction.GetProperty("Enter street"));
                    var houseNumber = Checker.GetPropertyHome(BaseConsoleFunction.GetProperty("Enter house number"));
                    var address     = AddressController.CreateAddress(street, houseNumber);
                    _clientController.CreateOrder(phoneNumber, address, _basketController.Basket);
                    _basketController.ClearBasket();
                    Console.WriteLine("Order was created!");
                    Console.ReadLine();
                }
            }
            else
            {
                BaseConsoleFunction.GetProperty("Your basket is empty. Press enter to continue ");
            }
        }