public async Task <List <Dizziness> > GetAllDizzinessesByDateAsync(DateTime dateTime, long?patientId) { return(await _dizzinessResource.GetAllDizzinessesAsync(LogicHelper.GetPatientId(patientId), dateTime)); }
public async Task <List <JournalEntry> > GetAllJournalEntriesByDateAsync(DateTime dateTime, long?patientId) { return(await _journalEntryResource.GetAllJournalEntriesAsync(LogicHelper.GetPatientId(patientId), dateTime)); }
public async Task <List <JournalViewModel> > GetAllJournalItemsAsync(DateTime dateTime, long?patientId) { List <Dizziness> dizzinesses = await _dizzinessController.GetAllDizzinessesByDateAsync(dateTime, LogicHelper.GetPatientId(patientId)); List <JournalEntry> journalEntries = await _journalEntryController.GetAllJournalEntriesByDateAsync(dateTime, LogicHelper.GetPatientId(patientId)); List <JournalViewModel> viewModels = new List <JournalViewModel>(); viewModels.AddRange(await DizzinessJournalViewModelConverter(dizzinesses, patientId)); viewModels.AddRange(journalEntries.ConvertAll(new Converter <JournalEntry, JournalViewModel>(JournalEntryJournalViewModelConverter))); viewModels.Sort((a, b) => a.Created.CompareTo(b.Created)); return(viewModels); }
public async Task <List <JournalLogViewModel> > GetAllJournalLogsAsync(long?patientId) { List <JournalLog> logs = await _journalLogResource.GetAllJournalLogsAsync(LogicHelper.GetPatientId(patientId)); return(logs.ConvertAll(new Converter <JournalLog, JournalLogViewModel>(JournalViewConverter))); }
public async Task <List <ExerciseViewModel> > GetAllExerciseViewModelsAsync(long?patientId) { List <ExerciseViewModel> viewModels = new List <ExerciseViewModel>(); viewModels.AddRange(ConvertToViewModel(await _customExerciseResource.GetAllCustomExercisesAsync(LogicHelper.GetPatientId(patientId)), ExerciseType.Custom)); viewModels.AddRange(ConvertToViewModel(await _exerciseResource.GetAllExercisesAsync(), ExerciseType.Normal)); List <Exercise> favoriteExercises = await _exerciseFavoriteResource.GetAllFavoriteExercisesAsync(LogicHelper.GetPatientId(patientId)); foreach (Exercise favorite in favoriteExercises) { ExerciseViewModel ex = viewModels.Find(x => x.Id == favorite.Id); ex.Type = ExerciseType.Favorite; } List <Recommendation> recommendations = await _recommendationResource.GetAllRecommendationsAsync(LogicHelper.GetPatientId(patientId)); foreach (Recommendation recommendation in recommendations) { ExerciseViewModel ex = viewModels.Find(x => x.Id == recommendation.ExerciseId); ex.Type = ExerciseType.Recommended; ex.Recommendation = recommendation; } return(viewModels); }