예제 #1
0
        public async Task <IActionResult> GetGradeByCourseId([FromRoute] long courseId)
        {
            try
            {
                var seminarGroups = await _seminarGroupService.ListSeminarGroupIdByStudentIdAsync(User.Id());

                return(Json(seminarGroups.Select(s => new
                {
                    seminarName = _seminarService.GetSeminarBySeminarIdAsync(s.SeminarId).Result.Name,
                    groupName = s.Id + "组", //这里还是没有组名的问题
                    leaderName = _userService.GetUserByUserIdAsync(s.LeaderId).Result.Name,
                    presentationGrade = s.PresentationGrade,
                    reportGrade = s.ReportGrade,
                    grade = s.FinalGrade
                })));
            }
            catch (CourseNotFoundException)
            {
                return(StatusCode(404, new { msg = "未找到讨论课" }));
            }
            catch (ArgumentException)
            {
                return(StatusCode(400, new { msg = "课程ID格式错误" }));
            }
        }
예제 #2
0
        public async Task <IActionResult> GetSeminarById([FromRoute] long seminarId)
        {
            try
            {
                var sem = await _seminarService.GetSeminarBySeminarIdAsync(seminarId);

                return(Json(new
                {
                    id = sem.Id,
                    name = sem.Name,
                    description = sem.Description,
                    startTime = sem.StartTime.ToString("yyyy-MM-dd"),
                    endTime = sem.EndTime.ToString("yyyy-MM-dd")
                }));
            }
            catch (SeminarNotFoundException)
            {
                return(StatusCode(404, new { msg = "讨论课不存在" }));
            }
            catch (ArgumentException)
            {
                return(StatusCode(400, new { msg = "讨论课ID输入格式有误" }));
            }
        }
예제 #3
0
 /// 老师获取该班级签到、分组状态.
 public Task <Location> GetCallStatusByIdAsync(long seminarId, long classId)
 {
     _seminarService.GetSeminarBySeminarIdAsync(seminarId);
     //_classDao.GetAsync(classId);
     return(_classDao.GetLocation(seminarId, classId));
 }