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