コード例 #1
0
        /// <summary>
        /// 修改班级课程
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-09-10</para>
        /// </summary>
        /// <param name="request">修改的教室分配及学位设置数据</param>
        /// <exception cref="BussinessException">
        /// 异常ID:1,异常描述:课程信息为空;教室信息为空
        /// </exception>
        public async Task Modify(ClassRoomRequest request)
        {
            //校验是否可以修改
            var course = _tblDatRoomCourseRepository.Value.Load(_roomCourseId);

            if (course == null)
            {
                throw new BussinessException((byte)ModelType.Default, 1);
            }

            var classRoom = _tblDatClassRoomRepository.Value.Load(course.ClassRoomId);

            if (classRoom == null)
            {
                throw new BussinessException((byte)ModelType.Default, 1);
            }

            //3、准备数据
            course.MaxStageStudents = request.MaxStageStudents;
            course.MaxWeekStage     = request.MaxWeekStage;
            course.UpdateTime       = DateTime.Now;

            //5、执行数据库更新
            await _tblDatRoomCourseRepository.Value.UpdateTask(course);
        }
コード例 #2
0
        /// <summary>
        /// 添加班级课程
        /// <para>作    者:zhiwei.Tang</para>
        /// <para>创建时间:2018-09-10</para>
        /// </summary>
        /// <param name="schoolId">校区编号</param>
        /// <param name="request">教室分配及学位设置数据源</param>
        /// <returns></returns>
        public static async Task AddAsync(string schoolId, ClassRoomRequest request)
        {
            //1、添加教室
            long classRoomId = await ClassRoomService.AddClassRoomAsync(schoolId, request.RoomNo);

            //2、准备数据
            TblDatRoomCourse roomCourse = new TblDatRoomCourse
            {
                RoomCourseId     = IdGenerator.NextId(),
                ClassRoomId      = classRoomId,
                CourseId         = request.CourseId,
                CreateTime       = DateTime.Now,
                IsDisabled       = false,
                MaxStageStudents = request.MaxStageStudents,
                MaxWeekStage     = request.MaxWeekStage,
                UpdateTime       = DateTime.Now
            };

            //3.添加课程
            await AddClassCourseAsync(roomCourse);
        }
コード例 #3
0
 public async Task Post([FromBody] ClassRoomRequest request)
 {
     await ClassRoomCourseService.AddAsync(base.SchoolId, request);
 }
コード例 #4
0
 public async Task Put(long roomCourseId, [FromBody] ClassRoomRequest request)
 {
     ClassRoomCourseService classRoomService = new ClassRoomCourseService(roomCourseId);
     await classRoomService.Modify(request);
 }