コード例 #1
0
ファイル: CourseCommandHandler.cs プロジェクト: anbu06/lms
        public async Task HandleAsync(CourseUpdateLandingPageCommand command)
        {
            var course = _context.Course.FirstOrDefault(x => x.Id == command.CourseId);

            course.LandingPage = command.Content;
            await _context.SaveChangesAsync();
        }
コード例 #2
0
ファイル: CourseController.cs プロジェクト: anbu06/lms
        public async Task <IActionResult> UpdateLandingPage(int courseId, CourseUpdateLandingPageCommand command)
        {
            if (!_userResolver.HasCoursePrivilege(courseId, new List <PrivilegeEnum>()
            {
                PrivilegeEnum.CanManageCourse, PrivilegeEnum.CanManageCourseFiles, PrivilegeEnum.CanUploadCourseFiles
            }))
            {
                return(Unauthorized());
            }
            await _commandBus.ExecuteAsync(command);

            return(Ok());
        }