Example #1
0
        //User synchronizes home meals
        public async Task <List <MealModel> > SynchronizeMealsAsync(UserModel user)
        {
            if (user.Position == (int)UserPosition.HasNotHome)
            {
                CustomException errors = new CustomException((int)HttpStatusCode.BadRequest);
                errors.AddError("Home Not Exist", "User is not member of a home");
                errors.Throw();
            }

            user = await _userRepository.GetByIdAsync(user.Id, true);

            return(await _mealRepository.GetAllHomeMealsAsync(user.Home.Id));
        }