Exemplo n.º 1
0
        public async Task <ActionResult <Meal> > AddMeal(Meal item)
        {
            try
            {
                if (item == null)
                {
                    return(BadRequest(item));
                }

                var meal = await _mealDataModel.InsertAsync(item).ConfigureAwait(true);

                return(CreatedAtAction(nameof(AddMeal), new { id = meal.Id }, meal));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, GetType().Name);
                throw;
            }
        }
Exemplo n.º 2
0
 public async Task InsertAsync(Meal item)
 {
     await _mealDataModel.InsertAsync(item).ConfigureAwait(false);
 }