Пример #1
0
        //Public Methods
        public UserIdentity UpdateUserIdentity(UserIdentity updatedUserIdentity)
        {
            if (!string.IsNullOrEmpty(updatedUserIdentity.UserId))
            {
                UserIdentity currentUserIdentity = _dynamo.GetItem <UserIdentity>(updatedUserIdentity.UserId);

                if (currentUserIdentity != null)
                {
                    try
                    {
                        _dynamo.UpdateItem(updatedUserIdentity);
                    }
                    catch (Exception)
                    {
                        throw new FaildToConnectDbException();
                    }
                }
                else
                {
                    CreateUserIdentity(updatedUserIdentity);
                }

                updatedUserIdentity.UserId = null;
                return(updatedUserIdentity);
            }
            else
            {
                throw new NotMatchException("UserId");
            }
        }
Пример #2
0
        //Private Methods
        private bool IsEmailAvailable(string email)
        {
            User foundUser;

            try
            {
                foundUser = _dynamo.GetItem <User>(email);
            }
            catch (Exception)
            {
                throw new FaildToConnectDbException();
            }
            return(foundUser == null);
        }