public async Task <IActionResult> GetUserHistory(string userId) { if (userId != null) { var history = await _diag.GetUserHistoryByUserId(userId); List <UserHistoryDto> AllHistoryMapped = new List <UserHistoryDto>(); foreach (var item in history) { var historyMapped = new UserHistoryDto(); historyMapped.DrugName = item.Drug.DrugName; historyMapped.SymptomName = item.Symptom.SymptomName; historyMapped.TimeCreated = item.TimeCreated; historyMapped.BodyAreasName = item.BodyAreas.NameArea; historyMapped.RequestId = item.RequestId; AllHistoryMapped.Add(historyMapped); } return(Ok(AllHistoryMapped)); } return(BadRequest("Cheak Your Object")); }