Esempio 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;
            }
        }
Esempio n. 2
0
 public async Task InsertAsync(Meal item)
 {
     await _mealDataModel.InsertAsync(item).ConfigureAwait(false);
 }