public void Init() { conection = new MSSQLDB(new DBConfiguration()); _SREP = new StudentRepository(conection); _encryptor = new Encryptor(); handler = new StudentCommandHandler(_SREP, _encryptor); var db = conection.GetCon(); // Create Course course = new Course(Guid.NewGuid(), "LTP5"); var sql = "INSERT INTO [Course] ([Id], [Name]) VALUES (@Id, @Name)"; db.Execute(sql, param: new { Id = course.CourseId, Name = course.Name }); var cpf = "964.377.278-02"; string password = cpf.Replace("-", "").Replace(".", ""); password = _encryptor.Encrypt(password, out string salt); student = new Student(course, DateTime.Now, "Abmael", "Araujo", cpf, "*****@*****.**", "(86) 2802-4826", "M", "Brasil", "Araguaina", "Centro", password, salt); _SREP.Create(student); commandRegister = new StudentInputRegister() { CourseId = course.CourseId, Birthdate = DateTime.Now, FirstName = "Ester", LastName = "Emily Oliveira", CPF = "494.035.320-68", Email = "*****@*****.**", Phone = "(45) 2509-8770", Gender = "M", Country = "Brasil", City = "Araguaina", Address = "Centro" }; commandUpdate = new StudentInputUpdate() { CourseId = course.CourseId, Birthdate = DateTime.Now, FirstName = "Iago", LastName = "Bernardo Nunes", Email = "*****@*****.**", Phone = "(65) 3544-9294", Gender = "M", Country = "França", City = "Budapeste", Address = "Norte", StudentId = student.Id }; }
public StudentController(StudentQueryHandler studentQuery, StudentCommandHandler studentCommand, CourseQueryHandler courseQuery, UserQueryHandler userQuery) : base(userQuery) { _studentQuery = studentQuery; _studentCommand = studentCommand; _courseQuery = courseQuery; }
public StudentController(IStudentRepository studentRepository, StudentCommandHandler handler) { _studentRepository = studentRepository; _handler = handler; }