コード例 #1
0
        /// <summary>
        /// Get all filtered professions by <paramref name="paginationParams"/>
        /// </summary>
        /// <returns>Returns the filtered profession.</returns>
        public async Task <PaginationDTO <ProfessionDTO> > GetProfessionsAsync(PaginationParamsWithSpec <ProfessionSpec> paginationParams)
        {
            var(professions, pageCount, totalDataCount) = await _professionRepository.PreparePaginationDTO(paginationParams.PageIndex,
                                                                                                           paginationParams.RequestedItemCount,
                                                                                                           paginationParams.OrderByProperty,
                                                                                                           paginationParams.OrderByAscending,
                                                                                                           paginationParams.Spec?.ToExpression()).ConfigureAwait(false);

            return(new PaginationDTO <ProfessionDTO>
            {
                DTOList = professions.CheckList(i => professions.Select(profession => new ProfessionDTO
                {
                    Name = profession.Name,
                    Id = profession.Id
                })),
                PageCount = pageCount,
                TotalDataCount = totalDataCount
            });
        }
コード例 #2
0
        /// <summary>
        /// Get all assignment for student by <paramref name="paginationParams"/>
        /// </summary>
        /// <returns>The assignments is put in the form of an AnnouncementForStudentDTO.</returns>
        public async Task <PaginationDTO <AssignmentForStudentDTO> > GetAssignmentsForStudentAsync(PaginationParamsWithSpec <AssignmentSpec> paginationParams)
        {
            var(assignments, pageCount, totalDataCount) = await _assignmentRepository.PreparePaginationDTO(paginationParams.PageIndex,
                                                                                                           paginationParams.RequestedItemCount,
                                                                                                           paginationParams.OrderByProperty,
                                                                                                           paginationParams.OrderByAscending,
                                                                                                           paginationParams.Spec?.ToExpression()).ConfigureAwait(false);

            assignments.ThrowIfListIsNullOrEmpty();

            return(new PaginationDTO <AssignmentForStudentDTO>
            {
                DTOList = assignments.CheckList(i => assignments.Select(assignment => new AssignmentForStudentDTO
                {
                    Id = assignment.Id,
                    Title = assignment.Title,
                    Description = assignment.Description,
                    RemarksToStudent = assignment.RemarksToStudent,
                    Level = assignment.Level,
                    Rules = assignment.Rules,
                    MaxDeliveryDay = assignment.MaxDeliveryDay,
                    ProfessionId = assignment.ProfessionId
                })),
                PageCount = pageCount,
                TotalDataCount = totalDataCount
            });
        }
コード例 #3
0
        /// <summary>
        /// Get all announcement for admin.
        /// </summary>
        /// <param name="paginationParams">Filter object.</param>
        /// <returns> The announcements is put in the form of an AnnouncementForAdminDTO.</returns>
        public async Task <PaginationDTO <AnnouncementForAdminDTO> > GetAnnouncementsForAdminAsync(PaginationParamsWithSpec <AnnouncementSpec> paginationParams)
        {
            Func <IIncludable <Announcement>, IIncludable> includes = i => i.Include(md => md.PublisherMentor);

            var(announcements, pageCount, totalDataCount) = await _announcementRepository.PreparePaginationDTO(paginationParams.PageIndex,
                                                                                                               paginationParams.RequestedItemCount,
                                                                                                               paginationParams.OrderByProperty,
                                                                                                               paginationParams.OrderByAscending,
                                                                                                               paginationParams.Spec?.ToExpression(),
                                                                                                               includes).ConfigureAwait(false);

            return(new PaginationDTO <AnnouncementForAdminDTO>
            {
                DTOList = announcements.CheckList(i => announcements.Select(announcement => new AnnouncementForAdminDTO
                {
                    Id = announcement.Id,
                    Title = announcement.Title,
                    Description = announcement.Description,
                    IsFixed = announcement.IsFixed,
                    PublisherMentor = announcement.PublisherMentor.CheckObject(i => new MentorDTO
                    {
                        Id = i.Id,
                        Name = i.Name,
                        Surname = i.Surname
                    })
                })),
                PageCount = pageCount,
                TotalDataCount = totalDataCount
            });
        }
コード例 #4
0
        public async Task <IActionResult> GetStudentsForAdmin([FromBody] PaginationParamsWithSpec <StudentSpec> paginationParams)
        {
            var students = await _studentService.GetStudentsForAdminAsync(paginationParams).ConfigureAwait(false);

            return(students.GetObjectResponse("Success"));
        }
コード例 #5
0
        public async Task <IActionResult> GetQuestionsForStudent([FromBody] PaginationParamsWithSpec <QuestionSpec> paginationParams)
        {
            var questions = await _questionService.GetQuestionsForStudentAsync(paginationParams).ConfigureAwait(false);

            return(questions.GetObjectResponse("Success"));
        }
コード例 #6
0
        public async Task <IActionResult> GetMentorsForAdmin([FromBody] PaginationParamsWithSpec <MentorSpec> paginationParams)
        {
            var mentors = await _mentorService.GetMentorsForAdminAsync(paginationParams).ConfigureAwait(false);

            return(mentors.GetObjectResponse("Success"));
        }
コード例 #7
0
        /// <summary>
        /// Get link for mentor.
        /// </summary>
        /// <returns></returns>
        public async Task <PaginationDTO <UsefulLinkDTO> > GetUsefulLinksForMentorAsync(PaginationParamsWithSpec <UsefulLinkSpec> paginationParams)
        {
            var(usefulLinks, pageCount, totalDataCount) = await _usefulLinkRepository.PreparePaginationDTO(paginationParams.PageIndex,
                                                                                                           paginationParams.RequestedItemCount,
                                                                                                           paginationParams.OrderByProperty,
                                                                                                           paginationParams.OrderByAscending,
                                                                                                           paginationParams.Spec?.ToExpression()).ConfigureAwait(false);

            return(new PaginationDTO <UsefulLinkDTO>
            {
                DTOList = usefulLinks.CheckList(i => usefulLinks.Select(link => new UsefulLinkDTO
                {
                    Id = link.Id,
                    Title = link.Title,
                    Description = link.Description,
                    Url = link.Url,
                    ProfessionId = link.ProfessionId,
                })),
                PageCount = pageCount,
                TotalDataCount = totalDataCount
            });
        }
コード例 #8
0
ファイル: StudentService.cs プロジェクト: Milvasoft/Milvasoft
        /// <summary>
        /// It will filter students according to the parameters sent in <paramref name="paginationParams"/>
        /// </summary>
        /// <exception cref="ArgumentNullException">If <paramref name="paginationParams"/> is null, it is thrown.</exception>
        /// <param name="paginationParams">Filtering object.</param>
        /// <returns>Student information that can be seen by admin.</returns>
        public async Task <PaginationDTO <StudentForAdminDTO> > GetStudentsForAdminAsync(PaginationParamsWithSpec <StudentSpec> paginationParams)
        {
            Func <IIncludable <Student>, IIncludable> includes = i => i.Include(md => md.Mentor);

            var(students, pageCount, totalDataCount) = await _studentRepository.PreparePaginationDTO(paginationParams.PageIndex,
                                                                                                     paginationParams.RequestedItemCount,
                                                                                                     paginationParams.OrderByProperty,
                                                                                                     paginationParams.OrderByAscending,
                                                                                                     paginationParams.Spec?.ToExpression(),
                                                                                                     includes).ConfigureAwait(false);

            return(new PaginationDTO <StudentForAdminDTO>
            {
                DTOList = students.CheckList(i => students.Select(student => new StudentForAdminDTO
                {
                    Id = student.Id,
                    Name = student.Name,
                    Surname = student.Surname,
                    University = student.University,
                    Age = student.Age,
                    HomeAddress = student.HomeAddress,
                    MentorThoughts = student.MentorThoughts,
                    IsConfidentialityAgreementSigned = student.IsConfidentialityAgreementSigned,
                    GraduationStatus = student.GraduationStatus,
                    GraduationScore = student.GraduationScore,
                    MentorGraduationThoughts = student.MentorGraduationThoughts,
                    ProfessionId = student.ProfessionId,
                    Mentor = student.Mentor.CheckObject(i => new MentorForAdminDTO
                    {
                        Name = i.Name,
                        Surname = i.Surname,
                        Id = i.Id
                    })
                })),
                PageCount = pageCount,
                TotalDataCount = totalDataCount
            });
        }
コード例 #9
0
ファイル: StudentService.cs プロジェクト: Milvasoft/Milvasoft
        /// <summary>
        /// Brings the students of the mentor who has entered.
        /// </summary>
        ///  <exception cref="ArgumentNullException">If the mentor does not enter, it is thrown..</exception>
        /// <param name="paginationParams">Filtering object.</param>
        /// <returns>Brings the students for whom the mentor is responsible.</returns>
        public async Task <PaginationDTO <StudentForMentorDTO> > GetStudentsForCurrentMentorAsync(PaginationParamsWithSpec <StudentSpec> paginationParams)
        {
            var currentMentor = await _mentorRepository.GetFirstOrDefaultAsync(i => i.AppUser.UserName == _loggedUser).ConfigureAwait(false);

            Func <IIncludable <Student>, IIncludable> includes = i => i.Include(md => md.Mentor)
                                                                 .Include(oa => oa.OldAssignments);

            var(students, pageCount, totalDataCount) = await _studentRepository.PreparePaginationDTO(paginationParams.PageIndex,
                                                                                                     paginationParams.RequestedItemCount,
                                                                                                     paginationParams.OrderByProperty,
                                                                                                     paginationParams.OrderByAscending,
                                                                                                     paginationParams.Spec?.ToExpression(),
                                                                                                     includes).ConfigureAwait(false);

            return(new PaginationDTO <StudentForMentorDTO>
            {
                DTOList = students.CheckList(i => students.Select(students => students.MentorId == currentMentor.Id ? new StudentForMentorDTO
                {
                    Id = students.Id,
                    Name = students.Name,
                    Surname = students.Surname,
                    University = students.University,
                    Age = students.Age,
                    Dream = students.Dream,
                    HomeAddress = students.HomeAddress,
                    MentorThoughts = students.MentorThoughts,
                    GraduationStatus = students.GraduationStatus,
                    GraduationScore = students.GraduationScore,
                    MentorGraduationThoughts = students.MentorGraduationThoughts,
                    ProfessionId = students.ProfessionId,
                    Mentor = students.Mentor.CheckObject(i => new MentorDTO
                    {
                        AppUserId = i.AppUserId,
                        Name = i.Name,
                        Id = i.Id
                    }),
                    CurrentAssigmentDeliveryDate = students.CurrentAssigmentDeliveryDate,
                    OldAssignments = students.OldAssignments.CheckList(f => students.OldAssignments.Select(oa => oa.Status != Entity.Enum.EducationStatus.InProgress ? new StudentAssignmentDTO
                    {
                        Id = oa.Id,
                    } : null))
                } : null)),
                PageCount = pageCount,
                TotalDataCount = totalDataCount
            });
        }
コード例 #10
0
        public async Task<IActionResult> GetAssignmentsForStudent([FromBody] PaginationParamsWithSpec<AssignmentSpec> paginationParams)
        {
            var assignments = await _assigmentService.GetAssignmentsForStudentAsync(paginationParams).ConfigureAwait(false);

            return assignments.GetObjectResponse("Success");
        }
コード例 #11
0
        /// <summary>
        /// Get all questions for admin.
        /// </summary>
        /// <returns></returns>
        public async Task <PaginationDTO <QuestionForMentorDTO> > GetQuestionsForMentorAsync(PaginationParamsWithSpec <QuestionSpec> paginationParams)
        {
            Func <IIncludable <Question>, IIncludable> includes = i => i.Include(md => md.Mentor)
                                                                  .Include(st => st.Student);


            var(questions, pageCount, totalDataCount) = await _questionRepository.PreparePaginationDTO(paginationParams.PageIndex,
                                                                                                       paginationParams.RequestedItemCount,
                                                                                                       paginationParams.OrderByProperty,
                                                                                                       paginationParams.OrderByAscending,
                                                                                                       paginationParams.Spec?.ToExpression(),
                                                                                                       includes).ConfigureAwait(false);

            return(new PaginationDTO <QuestionForMentorDTO>
            {
                DTOList = questions.CheckList(i => questions.Select(question => new QuestionForMentorDTO
                {
                    Id = question.Id,
                    Title = question.Title,
                    QuestionContent = question.QuestionContent,
                    MentorReply = question.MentorReply,
                    IsUseful = question.IsUseful,
                    WillShown = question.WillShown,
                    ProfessionId = question.ProfessionId,
                    Mentor = question.Mentor.CheckObject(i => new MentorDTO
                    {
                        Id = (Guid)question.MentorId
                    }),
                    Student = question.Student.CheckObject(i => new StudentDTO
                    {
                        Id = i.Id
                    })
                })),
                PageCount = pageCount,
                TotalDataCount = totalDataCount
            });
        }
コード例 #12
0
        public async Task <IActionResult> GetUsefulLinksForStudent([FromBody] PaginationParamsWithSpec <UsefulLinkSpec> paginationParams)
        {
            var usefulLinks = await _userfulLinkService.GetUsefulLinksForStudentAsync(paginationParams).ConfigureAwait(false);

            return(usefulLinks.GetObjectResponse("Success"));
        }
コード例 #13
0
        public async Task <IActionResult> GetProfessions([FromBody] PaginationParamsWithSpec <ProfessionSpec> paginationParams)
        {
            var professions = await _professionService.GetProfessionsAsync(paginationParams).ConfigureAwait(false);

            return(professions.GetObjectResponse("Success"));
        }
コード例 #14
0
        public async Task <IActionResult> GetAnnouncementsForMentor([FromBody] PaginationParamsWithSpec <AnnouncementSpec> paginationParams)
        {
            var announcements = await _announcementService.GetAnnouncementsForMentorAsync(paginationParams).ConfigureAwait(false);

            return(announcements.GetObjectResponse("Success"));
        }
コード例 #15
0
        /// <summary>
        /// Get mentors for admin.
        /// </summary>
        /// <returns></returns>
        public async Task <PaginationDTO <MentorForAdminDTO> > GetMentorsForAdminAsync(PaginationParamsWithSpec <MentorSpec> paginationParams)
        {
            Func <IIncludable <Mentor>, IIncludable> includes = i => i.Include(p => p.PublishedAnnouncements)
                                                                .Include(s => s.Students)
                                                                .Include(p => p.Professions);

            var(mentors, pageCount, totalDataCount) = await _mentorRepository.PreparePaginationDTO(paginationParams.PageIndex,
                                                                                                   paginationParams.RequestedItemCount,
                                                                                                   paginationParams.OrderByProperty,
                                                                                                   paginationParams.OrderByAscending,
                                                                                                   paginationParams.Spec?.ToExpression(),
                                                                                                   includes).ConfigureAwait(false);

            return(new PaginationDTO <MentorForAdminDTO>
            {
                DTOList = mentors.CheckList(i => mentors.Select(mentor => new MentorForAdminDTO
                {
                    Id = mentor.Id,
                    Name = mentor.Name,
                    Surname = mentor.Surname,
                    CVFilePath = mentor.CVFilePath,
                    Professions = mentor.Professions.CheckList(i => mentor.Professions?.Select(pr => new MentorProfessionDTO
                    {
                        Id = pr.ProfessionId
                    })),
                    PublishedAnnouncements = mentor.PublishedAnnouncements.CheckList(i => mentor.PublishedAnnouncements?.Select(pa => new AnnouncementDTO
                    {
                        Id = pa.Id
                    })),
                    Students = mentor.Students.CheckList(i => mentor.Students?.Select(st => new StudentDTO
                    {
                        Id = st.Id
                    }))
                })),
                PageCount = pageCount,
                TotalDataCount = totalDataCount
            });
        }