public async Task <ActionResult <Meal> > DeleteMeal(uint id) { try { if (id < 1) { return(BadRequest(id)); } var item = await _mealDataModel.FindAsync(id).ConfigureAwait(true); if (item != null) { await _mealDataModel.DeleteAsync(id).ConfigureAwait(true); return(CreatedAtAction(nameof(Meal), new { id }, item)); } return(NotFound(id)); } catch (Exception ex) { _logger.LogError(ex, GetType().Name); throw; } }
public async Task DeleteAsync(uint id) { await _mealDataModel.DeleteAsync(id).ConfigureAwait(false); _logger.LogDebug($"Delete Meal with id <{id}>"); }