Пример #1
0
        public async Task <IActionResult> GetUserMeals()
        {
            var userId   = userService.GetCurrentUserId(HttpContext);
            var response = await mealService.GetUserMeals(userId).ConfigureAwait(false);

            if (!response.IsSuccess)
            {
                return(BadRequest(response.Message));
            }

            var mealViewModels = mapper.Map <IEnumerable <Meal>, IEnumerable <MealViewModel> >(response.MealsFound);

            return(Ok(mealViewModels));
        }