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