public async Task <DiseaseResponse> Create(DiseaseDTO newDisease) { var disease = DiseaseMapper.Map(newDisease); if (disease == null) { string errorMessage = "Disease not found."; Log.Error(errorMessage); return(new DiseaseResponse(errorMessage)); } if (disease.Name == null) { string errorMessage2 = "Disease name not found."; Log.Error(errorMessage2); return(new DiseaseResponse(errorMessage2)); } if (disease.Description == null) { string errorMessage3 = "Disease description not found."; Log.Error(errorMessage3); return(new DiseaseResponse(errorMessage3)); } try { await _diseaseRepository.Create(disease); await _context.SaveChangesAsync(); return(new DiseaseResponse(DiseaseMapper.Map(disease))); } catch (Exception exception) { string errorMessage = $"An error occured when creating the item: {exception.Message}"; return(new DiseaseResponse(errorMessage)); } }