Beispiel #1
0
        public override User AddNewUser(AddNewUserContract contract)
        {
            var repo = repositories.GetUserRepository();

            if (repo.IfExistsUser(contract.Username, contract.Email))
            {
                throw new BusinessException(Constants.Message.Exception.UsernameAlreadyExists);
            }

            var newUser = new User
            {
                Username  = contract.Username,
                Password  = contract.Passwd,
                Email     = contract.Email,
                Firstname = contract.Firstname,
                Lastname  = contract.Lastname,
                Active    = contract.Active
            };

            repo.AddNewUser(newUser);

            var result = repo.AttachToUserAtApplicationAndRole(newUser.Id, appInsId, 0); // yeni bir method;

            repo.Save();

            return(newUser);
        }
Beispiel #2
0
        public override User AddNewUser(AddNewUserContract contract)
        {
            var repo = repositories.GetUserRepository();

            if (repo.IfExistsUser(contract.Username, contract.Email))
            {
                throw new BusinessException(Constants.Message.Exception.UsernameAlreadyExists);
            }

            var newUser = new User
            {
                Username  = contract.Username,
                Password  = contract.Passwd,
                Email     = contract.Email,
                Firstname = contract.Firstname,
                Lastname  = contract.Lastname,
                Active    = contract.Active
            };

            repo.AddNewUser(newUser);
            repo.Save();

            return(newUser);
        }
Beispiel #3
0
 public virtual User AddNewUser(AddNewUserContract contract)
 {
     throw new BusinessException(Constants.Message.Exception.HasNotAccess);
 }
Beispiel #4
0
        public Result Post([FromBody] AddNewUserContract contract)
        {
            var newUser = service.AddNewUser(contract);

            return(Result.Ok(Constants.Message.Sucess.RegisteredUser, newUser.Id));
        }