public IActionResult CreateFoodEntry([FromBody] FoodEntryCreateModel createModel) { CreateFoodEntryResponse response = _foodEntryService.CreateFoodEntry(createModel); if (!response.ResponseStatus.HasError()) { return(Ok()); } return(StatusCode(response.ResponseStatus.Status, response.ResponseStatus.Message)); }
public CreateFoodEntryResponse CreateFoodEntry(FoodEntryCreateModel createModel) { CreateFoodEntryResponse response = new CreateFoodEntryResponse(); try { _foodEntryRepository.CreateFoodEntry(createModel); response.ResponseStatus.SetOk(); } catch (Exception e) { _logger.LogError(e.ToString()); response.ResponseStatus.SetError(ResponseStatusCode.INTERNAL_SERVER_ERROR, e.ToString()); } return(response); }