Exemplo n.º 1
0
        public async Task <IActionResult> GetTimeTableDetailsForStaffAsync([FromBody] GetTimeTableAc getTimeTableAc)
        {
            if (!getTimeTableAc.StaffId.HasValue || getTimeTableAc.StaffId.Value == 0)
            {
                return(BadRequest(new ApiServiceResponse()
                {
                    Status = -100, Message = "Staff Id can't be empty"
                }));
            }
            else
            {
                StaffBasicPersonalInformation staff = await _iMSDbContext.StaffBasicPersonalInformation.FirstOrDefaultAsync(x => x.Id == getTimeTableAc.StaffId.Value);

                if (staff == null)
                {
                    return(NotFound(new ApiServiceResponse()
                    {
                        Status = -100, Message = "Staff not found"
                    }));
                }

                AddTimeTableAc timeTableDetails =
                    await _timeTableManagementRepository.GetTimeTableForStaffAsync(getTimeTableAc.ClassId, getTimeTableAc.SectionId, getTimeTableAc.StaffId.Value, getTimeTableAc.AcademicYearId, getTimeTableAc.InstituteId);

                return(Ok(new ApiServiceResponse {
                    Status = 200, Message = "Success", ResultObj = timeTableDetails
                }));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetTimeTableDetailsForStaffAsync(int classId, int sectionId, int academicYearId)
        {
            int instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            string currentUserId = (await _userManager.FindByNameAsync(User.Identity.Name)).Id;
            int    staffId       = (await _imsDbContext.StaffBasicPersonalInformation.FirstAsync(x => x.UserId == currentUserId)).Id;

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