예제 #1
0
        public List <Food> GetAllFoodsByCategory(string categoryName)
        {
            CategoryDataAccess categoryDataAccess = new CategoryDataAccess();
            int categoryId = categoryDataAccess.GetCategoryId(categoryName);

            this.foodDataAccess = new FoodDataAccess();
            return(this.foodDataAccess.GetFoodsByCategoryId(categoryId));
        }
예제 #2
0
        public int AddNewFood(string foodName, double foodprice, string categoryName)
        {
            CategoryDataAccess categoryDataAccess = new CategoryDataAccess();
            int categoryId = categoryDataAccess.GetCategoryId(categoryName);

            Food food = new Food()
            {
                FoodName   = foodName,
                FoodPrice  = foodprice,
                CategoryId = categoryId
            };

            this.foodDataAccess = new FoodDataAccess();
            return(this.foodDataAccess.AddFood(food));
        }
예제 #3
0
        public int UpdateExistingFood(int foodId, string foodName, double foodprice, string categoryName)
        {
            CategoryDataAccess categoryDataAccess = new CategoryDataAccess();
            int  categoryId = categoryDataAccess.GetCategoryId(categoryName);
            Food food       = new Food()
            {
                FoodId     = foodId,
                FoodName   = foodName,
                FoodPrice  = foodprice,
                CategoryId = categoryId
            };

            this.foodDataAccess = new FoodDataAccess();
            return(this.foodDataAccess.UpdateFood(food));
        }
        public int AddNewOrder(string customerName, int customerNumber, string orderdCategory, string orderdFood, int price, string DeliveryType, string categoryName)
        {
            CategoryDataAccess categoryDataAccess = new CategoryDataAccess();
            int categoryId = categoryDataAccess.GetCategoryId(categoryName);

            Order order = new Order()
            {
                CustomerName   = customerName,
                CustomerNumber = customerNumber,
                OrderdCategory = orderdCategory,
                OrderdFood     = orderdFood,
            };

            this.orderDataAccess = new OrderDataAccess();
            return(this.orderDataAccess.AddOrder(order));
        }