Пример #1
0
        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
            };
        }
Пример #2
0
        public StudentResultQueryList Handle(StudentInputList command)
        {
            var result = new StudentResultQueryList();

            result.Students = _SREP.List();

            return(result);
        }