public IActionResult DeleteFoodEntry(Guid id) { DeleteFoodEntryResponse response = _foodEntryService.DeleteFoodEntry(id); if (!response.ResponseStatus.HasError()) { return(Ok()); } return(StatusCode(response.ResponseStatus.Status, response.ResponseStatus.Message)); }
public DeleteFoodEntryResponse DeleteFoodEntry(Guid foodEntryId) { //TODO: Handle food entry with non existent id DeleteFoodEntryResponse response = new DeleteFoodEntryResponse(); try { _foodEntryRepository.DeleteFoodEntry(foodEntryId); response.ResponseStatus.SetOk(); } catch (Exception e) { _logger.LogError(e.ToString()); response.ResponseStatus.SetError(ResponseStatusCode.INTERNAL_SERVER_ERROR, e.ToString()); } return(response); }