Exemplo n.º 1
0
        public FoodDto AddFood(FoodParameter foodParameter, int userId)
        {
            var newFood = new Food()
            {
                FoodName  = foodParameter.FoodName,
                Remark    = foodParameter.Remark,
                CreatedBy = userId,
                CreatedAt = DateTime.Now
            };

            _foodRepositories.AddFood(newFood);
            return(FoodDto.ToFoodDto(newFood));
        }
Exemplo n.º 2
0
        public FoodDto UpdateFood(FoodParameter foodParameter, int userId)
        {
            var food = _foodRepositories.GetFood(foodParameter.Id);

            if (food != null)
            {
                food.FoodName  = foodParameter.FoodName;
                food.Remark    = foodParameter.Remark;
                food.UpdatedBy = userId;
                food.UpdatedAt = DateTime.Now;
                return(FoodDto.ToFoodDto(_foodRepositories.UpdateFood(food)));
            }

            return(null);
        }
Exemplo n.º 3
0
        public FoodDto GetFood(int Id)
        {
            var food = _foodRepositories.GetFood(Id);

            return(FoodDto.ToFoodDto(food));
        }