public void Init() { conection = new MSSQLDB(new DBConfiguration()); _SREP = new StudentRepository(conection); _encryptor = new Encryptor(); handler = new StudentQueryHandler(_SREP); 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); commandGetById = new StudentInputGetById() { StudentId = student.Id }; commandList = new StudentInputList(); commandGetByCPF = new StudentInputGetByCPF() { StudentCPF = student.CPF.Number }; }
public StudentResultQueryGet Handle(StudentInputGetByCPF command) { var result = new StudentResultQueryGet(); result.Student = _SREP.Get(command.StudentCPF); return(result); }