public async Task HandleAsync(CourseUpdatePasswordCommand command) { var course = _context.Course.FirstOrDefault(x => x.Id == command.CourseId); course.Password = command.NewPassword; await _context.SaveChangesAsync(); }
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()); }