public async Task <IActionResult> PostClients([FromBody] Clients clients) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } string cliPassword = clients.cliPassword; clients.cliPassword = SaltPassword.GetPasswordHash(clients.cliPassword); _context.clients.Add(clients); await _context.SaveChangesAsync(); clients.cliPassword = cliPassword; await Authenticate(clients); clients.cliPassword = null; return(CreatedAtAction("GetClients", new { id = clients.cliId }, clients)); }
public void PopulateDataBase() { new EmployeDataService(_cache, _serializer, _errorLogger).PostEmploye(new Employe("Test", SaltPassword.GetPasswordHash("test"))); new EmployeDataService(_cache, _serializer, _errorLogger).PostEmploye(new Employe("Test2", SaltPassword.GetPasswordHash("test2"))); new EmployeDataService(_cache, _serializer, _errorLogger).PostEmploye(new Employe("Test3", SaltPassword.GetPasswordHash("test3"))); new EmployeDataService(_cache, _serializer, _errorLogger).PostEmploye(new Employe("Test3", SaltPassword.GetPasswordHash("test4"))); new EmployeDataService(_cache, _serializer, _errorLogger).PostEmploye(new Employe("Test4", SaltPassword.GetPasswordHash("test5"))); new EmployeDataService(_cache, _serializer, _errorLogger).PostEmploye(new Employe("Test5", SaltPassword.GetPasswordHash("test6"))); new EmployeDataService(_cache, _serializer, _errorLogger).PostEmploye(new Employe("Test6", SaltPassword.GetPasswordHash("test7"))); }