public ActionResult Create([Bind(Include = "Id,Nome,Sobrenome")] Professor professor) { try { if (ModelState.IsValid) { _professorRepository.Create(professor); TempData["Success"] = "Registro criado com sucesso."; } return(View()); } catch (InvalidOperationException IEx) { TempData["Error"] = IEx.Message; return(View()); } }
public void Init() { conection = new MSSQLDB(new DBConfiguration()); _PREP = new ProfessorRepository(conection); _encryptor = new Encryptor(); handler = new ProfessorQueryHandler(_PREP); var db = conection.GetCon(); var cpf = "357.034.413-40"; string password = cpf.Replace("-", "").Replace(".", ""); password = _encryptor.Encrypt(password, out string salt); professor = new Professor("Lívia", "Emanuelly Elisa", cpf, "*****@*****.**", "(21) 2682-8370", EDegree.Master, password, salt); _PREP.Create(professor); commandGet = new ProfessorInputGet() { ProfessorId = professor.Id }; }
public void Init() { conection = new MSSQLDB(new DBConfiguration()); _PREP = new ProfessorRepository(conection); _encryptor = new Encryptor(); handler = new ProfessorCommandHandler(_PREP, _encryptor); var db = conection.GetCon(); var cpf = "357.034.413-40"; string password = cpf.Replace("-", "").Replace(".", ""); password = _encryptor.Encrypt(password, out string salt); professor = new Professor("Lívia", "Emanuelly Elisa", cpf, "*****@*****.**", "(21) 2682-8370", EDegree.Master, password, salt); _PREP.Create(professor); commandRegister = new ProfessorInputRegister() { FirstName = "Lívia", LastName = "Emanuelly Elisa", CPF = cpf, Email = "*****@*****.**", Phone = "(21) 2682-8370", Degree = EDegree.Master }; commandUpdate = new ProfessorInputUpdate() { ProfessorId = professor.Id, FirstName = "Lívia", LastName = "Emanuelly Elisa", Email = "*****@*****.**", Phone = "(21) 2682-8370", Degree = EDegree.Master }; }