Esempio n. 1
0
        public async Task HandleAsync(CourseUpdatePasswordCommand command)
        {
            var course = _context.Course.FirstOrDefault(x => x.Id == command.CourseId);

            course.Password = command.NewPassword;
            await _context.SaveChangesAsync();
        }
Esempio n. 2
0
        public async Task <IActionResult> ChangePassword(int courseId, CourseUpdatePasswordCommand command)
        {
            if (!_userResolver.HasCoursePrivilege(courseId, new List <PrivilegeEnum>()
            {
                PrivilegeEnum.CanManageCourse
            }))
            {
                return(Unauthorized());
            }
            await _commandBus.ExecuteAsync(command);

            return(Ok());
        }