Example #1
0
        /// <summary>
        /// Method to get homework - SS
        /// </summary>
        /// <param name="getHomework">get homework detail</param>
        /// <param name="instituteId">institute id</param>
        /// <returns>home work detail</returns>
        public async Task <Homework> GetHomeworkAsync(GetHomeworkAc getHomework, int instituteId)
        {
            var homeWork = await _iMSDbContext.Homeworks.Include(s => s.HomeworkSubjectMappings).FirstOrDefaultAsync(x =>
                                                                                                                     x.ClassId == getHomework.ClassId && x.StaffId == getHomework.StaffId && x.SectionId == getHomework.SectionId &&
                                                                                                                     x.Class.InstituteId == instituteId && x.HomeworkDate.Date == getHomework.Date.Date);

            if (homeWork != null)
            {
                homeWork.HomeworkMessageMappings = await _iMSDbContext.HomeworkMessageMappings.Include(s => s.StudentRecieveHomeworkMessageMappings)
                                                   .Where(x => x.HomeworkId == homeWork.Id).ToListAsync();
            }
            return(homeWork);
        }
Example #2
0
        public async Task <IActionResult> GetHomeworkAsync([FromBody] GetHomeworkAc getHomework)
        {
            var instituteId = await GetUserCurrentSelectedInstituteIdAsync();

            return(Ok(await _homeworkManagementRepository.GetHomeworkAsync(getHomework, instituteId)));
        }