/// <summary>
        /// Creates a user in DBV
        /// </summary>
        /// <param name="userEntity"></param>
        /// <returns></returns>
        public Guid CreateUser(CustomerAPI userEntity)
        {
            using (var scope = new TransactionScope())
            {
                var userHMIS = new CustomerAPI
                {
                    EmailAddress = userEntity.EmailAddress,
                    UserAgent = userEntity.UserAgent,
                    //  password = EncryptText("wgt_hmis", userEntity.password),
                    FirstName = userEntity.FirstName,
                    LastName = userEntity.LastName,
                    Address1 = userEntity.Address1,
                    Address2 = userEntity.Address2,
                    City = userEntity.City,
                    CreatedOn = DateTime.Now,
                    // CreatedBy = "To be done",
                    Postcode = userEntity.Postcode,
                    Password = userEntity.Password,
                    AuthData = userEntity.AuthData

                };
                _dynamoDataService.Store(userHMIS);
                //  _unitOfWork.Save();
                scope.Complete();
                return userHMIS.Id;
            }
        }
Exemplo n.º 2
0
        //Public Methods
        public string Register(UserLoginDTO userDTO)
        {
            if (IsEmailAvailable(userDTO.Email))
            {
                string token;
                User   userToRegister = new User()
                {
                    Email = userDTO.Email, Password = userDTO.Password
                };
                try
                {
                    _dynamo.Store(userToRegister);
                }
                catch (Exception)
                {
                    throw new FaildToConnectDbException();
                }

                token = _tokenManager.GenerateToken(userToRegister.UserId, userToRegister.Email);
                CreateUserNodeOnGraphDb(userToRegister.UserId, userToRegister.Email);
                CreateUserIdentity(userToRegister.UserId, userToRegister.Email, token);

                return(token);
            }
            else
            {
                throw new AlreadyExistException("Email");
            }
        }
Exemplo n.º 3
0
 //Private Methods
 private void CreateUserIdentity(UserIdentity updatedUserIdentity)
 {
     try
     {
         _dynamo.Store(updatedUserIdentity);
     }
     catch (Exception)
     {
         throw new FaildToConnectDbException();
     }
 }
Exemplo n.º 4
0
        //Private Methods
        private void AddToTokenHistory(string userId, string token)
        {
            TokenHistory tokenHistory = new TokenHistory()
            {
                UserId    = userId,
                TimeStamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds,
                Token     = token
            };

            try
            {
                _dynamo.Store(tokenHistory);
            }
            catch (Exception)
            {
                throw new FaildToConnectDbException();
            }
        }
Exemplo n.º 5
0
 /// <summary>
 ///  AddSample will accept a Sample object and creates an Item on Amazon DynamoDB
 /// </summary>
 /// <param name="sample"></param>
 public void AddSample(Sample sample)
 {
     _dynamoService.Store(sample);
 }
Exemplo n.º 6
0
 /// <summary>
 ///  AddDVD will accept a DVD object and creates an Item on Amazon DynamoDB
 /// </summary>
 /// <param name="dvd"></param>
 public void AddDvd(DVD dvd)
 {
     _dynamoService.Store(dvd);
 }
 public void AddRes(Reservation res)
 {
     _dynamoService.Store(res);
 }