public async Task <IActionResult> GetTimeTableDetailsAsync([FromBody] GetTimeTableAc getTimeTableAc)
        {
            AddTimeTableAc timeTableDetails = await _timeTableManagementRepository.GetTimeTableDetailsAsync(getTimeTableAc.ClassId, getTimeTableAc.SectionId, getTimeTableAc.AcademicYearId, getTimeTableAc.InstituteId);

            return(Ok(new ApiServiceResponse {
                Status = 200, Message = "Success", ResultObj = timeTableDetails
            }));
        }
示例#2
0
        /// <summary>
        /// Method for fetching the dashboard data of a logged in, non-admin user - RS
        /// </summary>
        /// <param name="currentUser"></param>
        /// <returns></returns>
        public async Task <UserDashboardAc> GetLoggedInUserDashboard(ApplicationUser currentUser, int academicYearId)
        {
            int currentUserInstituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(currentUser.Id, true);

            UserDashboardAc userDashboardAc = new UserDashboardAc();

            StudentBasicInformation studentUser = await _iMSDbContext.StudentBasicInformation
                                                  .Include(x => x.CurrentClass)
                                                  .Include(x => x.SectionMap)
                                                  .Include(x => x.Nationality)
                                                  .Include(x => x.Religion)
                                                  .FirstOrDefaultAsync(x => x.InstituteId == currentUserInstituteId && x.UserId.Equals(currentUser.Id));


            StaffBasicPersonalInformation staffUser = await _iMSDbContext.StaffBasicPersonalInformation
                                                      .Include(x => x.Nationality)
                                                      .Include(x => x.Religion)
                                                      .FirstOrDefaultAsync(x => x.InstituteId == currentUserInstituteId && x.UserId.Equals(currentUser.Id));

            List <StudentBasicInformation> totalStudents = await _iMSDbContext.StudentBasicInformation
                                                           .Where(x => x.InstituteId == currentUserInstituteId && x.IsActive).ToListAsync();

            if (studentUser != null)
            {
                userDashboardAc.Name                  = studentUser.FirstName + ' ' + studentUser.MiddleName + ' ' + studentUser.LastName;
                userDashboardAc.Nationality           = studentUser.Nationality?.Name;
                userDashboardAc.Institute             = (await _iMSDbContext.Institutes.FirstAsync(x => x.Id == currentUserInstituteId)).Name;
                userDashboardAc.PhoneNumber           = studentUser.MobileNumber;
                userDashboardAc.Email                 = studentUser.FamilyRelationEmail;
                userDashboardAc.Religion              = studentUser.Religion?.Name;
                userDashboardAc.Class                 = studentUser.CurrentClass?.Name;
                userDashboardAc.Section               = studentUser.SectionMap?.Name;
                userDashboardAc.PersonalImage         = studentUser.PersonalImage;
                userDashboardAc.RollNumber            = studentUser.RollNumber;
                userDashboardAc.ClassStudentCount     = totalStudents.Where(x => x.CurrentClassId == studentUser.CurrentClassId).Count();
                userDashboardAc.InstituteStudentCount = totalStudents.Count;
                userDashboardAc.TimeTableDetails      = await _timeTableManagementRepository.GetTimeTableDetailsAsync(studentUser.CurrentClassId, studentUser.SectionId.Value, academicYearId, currentUserInstituteId);

                userDashboardAc.UserDashboardType = UserDashboardTypeEnum.Student;
                userDashboardAc.ActivityList      = await _staffActivityManagementRepository.GetActivitiesForStudentAsync(currentUserInstituteId, studentUser.Id);
            }
            else if (staffUser != null)
            {
                userDashboardAc.Name              = staffUser.FirstName + ' ' + staffUser.MiddleName + ' ' + staffUser.LastName;
                userDashboardAc.Nationality       = staffUser.Nationality?.Name;
                userDashboardAc.Institute         = (await _iMSDbContext.Institutes.FirstAsync(x => x.Id == currentUserInstituteId)).Name;
                userDashboardAc.PhoneNumber       = staffUser.MobileNumber;
                userDashboardAc.Email             = staffUser.Email;
                userDashboardAc.Religion          = staffUser.Religion?.Name;
                userDashboardAc.PersonalImage     = staffUser.PersonalImage;
                userDashboardAc.EmployeeId        = staffUser.EmployeeId;
                userDashboardAc.UserDashboardType = UserDashboardTypeEnum.Staff;
                userDashboardAc.ClassList         = await _iMSDbContext.InstituteClasses.Where(x => x.InstituteId == currentUserInstituteId).ToListAsync();

                userDashboardAc.SectionsList = await _iMSDbContext.Sections.Where(x => x.InstituteId == currentUserInstituteId).ToListAsync();

                userDashboardAc.ActivityList = await _staffActivityManagementRepository.GetActivitiesForStaffAsync(currentUserInstituteId, staffUser.Id);

                userDashboardAc.InstituteStudentCount = totalStudents.Count;
            }

            return(userDashboardAc);
        }
        public async Task <IActionResult> GetTimeTableDetailsAsync(int classId, int sectionId, int academicYearId)
        {
            int instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            return(Ok(await _timeTableManagementRepository.GetTimeTableDetailsAsync(classId, sectionId, academicYearId, instituteId)));
        }