Esempio n. 1
0
        public async Task <ActionResult <Meal> > GetMeal(uint id)
        {
            try
            {
                if (id < 1)
                {
                    return(BadRequest(id));
                }

                var meal = await _mealDataModel.FindAsync(id).ConfigureAwait(true);

                if (meal != null)
                {
                    return(Ok(meal));
                }

                return(NotFound(id));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, GetType().Name);
                throw;
            }
        }
Esempio n. 2
0
 public async Task <Meal> FindAsync(uint id)
 {
     return(await _mealDataModel.FindAsync(id).ConfigureAwait(false));
 }