Ejemplo n.º 1
0
        public async Task <ResponseResult> Create(string userName, string password)
        {
            // check is username exists
            var existingUser = await data.GetByUserName(userName);

            if (existingUser != null)
            {
                return(new ResponseResult {
                    Success = false, Messages = new[] { ErrorMessage_UserNameExists }
                });
            }

            var passwordHash = passwordHasher.Hash(password);
            var response     = await data.Create(userName, passwordHash);

            return(response);
        }
Ejemplo n.º 2
0
 public async Task <int> AddUser(UserCompleteDataModel user)
 {
     return(await Task.Run <int>(async() =>
     {
         try
         {
             var id = await _userData.Create(user.User);
             user.UserRights.UserID = id;
             await _userRights.Create(user.UserRights);
             foreach (var fingerprint in user.UserFingerprints)
             {
                 fingerprint.UserId = id;
                 await _fingerPrintData.Create(fingerprint);
             }
             return id;
         }
         catch (Exception)
         {
             return 0;
         }
     }));
 }