public User AddUser(string name, int age, DateTime birth, string emblempath = null) { User user = new User(Guid.NewGuid(), age, name, birth, emblempath); if (daoUsers.AddUser(user)) { return(user); } return(null); }
public IActionResult AddUser(User user) { string success = $"{user.Username} successfully added."; string failed = $"{user.Username} failed to be added."; int response = 0; HashedPassword hashedPassword = passwordHasher.HashPassword(user.Password); User dbCheck = dao.GetUser(user.Username); user.Password = hashedPassword.Password; user.Salt = hashedPassword.Salt; if (dbCheck.Username != user.Username) { response = dao.AddUser(user); var token = tokenGenerator.GenerateToken(user.Username, user.Role); return(Ok()); } return(Forbid()); }
public void AddUser(string firstName, string secondName, DateTime birthDay, List <Award> awards) { usersDAO.AddUser(firstName, secondName, birthDay, awards); }
public void AddUser(User user) => _usersDAO.AddUser(user);