public async Task <ActionResult <Meal> > UpdateMeal(uint id, Meal item) { try { if (id < 1 || item == null) { return(BadRequest(id)); } var meal = await _mealDataModel.FindAsync(id).ConfigureAwait(true); if (meal != null) { meal = await _mealDataModel.UpdateAsync(item).ConfigureAwait(true); return(Ok(id)); } _logger.LogInformation($"Meal with id <{id}> not exist, create it."); return(await AddMeal(item).ConfigureAwait(true)); } catch (Exception ex) { _logger.LogError(ex, GetType().Name); throw; } }
public async Task UpdateAsync(Meal item) { await _mealDataModel.UpdateAsync(item).ConfigureAwait(false); }