예제 #1
0
        public ActionResult <IEnumerable <StudentTestDto> > GetTestsAssignedToStudent()
        {
            var res = new List <StudentTestDto>();

            //AutoMapper with LINQ ProjectTo:
            var sytnhesisTests = _synthesisRepository.GetAssigned(UserId);

            if (sytnhesisTests != null && sytnhesisTests.Any())
            {
                res.AddRange(sytnhesisTests.Select(sts => new StudentTestDto(sts)));
            }

            var analysisTests = _analysisRepository.GetAssigned(UserId);

            if (analysisTests != null && analysisTests.Any())
            {
                res.AddRange(analysisTests.Select(ats => new StudentTestDto(ats)));
            }

            return(res);
        }