public async Task <ActionResult <IEnumerable <ShortApplicationViewModel> > > GetShortApplicationsForSpecificUser() { var user = await _userManager.FindByNameAsync(User.Identity.Name); if (user == null) { return(NotFound()); } List <ExpertApplication> expertApplications = await _context.ExpertApplications.Where(x => x.UserId == user.Id).ToListAsync(); if (expertApplications.Count == 0) { return(NoContent()); } List <ShortApplicationViewModel> shortApplicationViewModels = new List <ShortApplicationViewModel>(); foreach (var application in expertApplications) { shortApplicationViewModels.Add(Mapper.ApplicationToShortViewModel(application, await _context.Subjects.Where(x => x.ID == application.SubjectId).FirstOrDefaultAsync())); } return(shortApplicationViewModels); }