Пример #1
0
        public async Task <IActionResult> AddAsync(AddMealBindingModel bindingModel)
        {
            var userId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier)?.Value);
            var result = await _mealService.AddAsync(bindingModel, userId);

            if (result.ErrorOccurred)
            {
                return(BadRequest(result));
            }
            return(Ok(result));
        }