Esempio n. 1
0
        internal ServiceResult AddBidderAccount(BAccountCreateViewModel vm, Guid auctionGuid)
        {
            ABUserModel abuserModel = new ABUserModel();

            abuserModel.Alias              = vm.Alias;
            abuserModel.Email              = vm.EmailAddress;
            abuserModel.Password           = vm.Password;
            abuserModel.ABUserGUID         = Guid.NewGuid();
            abuserModel.ABUser_AuctionGUID = auctionGuid;
            abuserModel.Money              = vm.Money;

            ABUser addBidderSuccess = SaveBidderAccount(abuserModel);
            bool   commitSuccess    = UpdateUser(addBidderSuccess);

            if (commitSuccess)
            {
                return(new ServiceResult()
                {
                    Success = true,
                    Params = addBidderSuccess.ToString()
                });
            }

            return(new ServiceResult()
            {
                ErrorMessage = "Error message",
                Success = false
            });
        }
Esempio n. 2
0
        internal ServiceResult UpdateAccountWithMoney(DepositMoneyViewModel vm)
        {
            UserInfoModel sessionVar              = (UserInfoModel)HttpContext.Current.Session["User"];
            var           currEmail               = sessionVar.Email;
            ABUser        currentUser             = GetUserByUserName(currEmail);
            var           currentUserMoneyBalance = currentUser.Money;

            currentUser.Money = currentUserMoneyBalance + vm.Money;
            _userRepository.Update(currentUser);


            bool commitSuccess = UpdateUser(currentUser);

            if (commitSuccess)
            {
                return(new ServiceResult()
                {
                    Success = true,
                    Params = currentUser.ToString()
                });
            }

            return(new ServiceResult()
            {
                ErrorMessage = "Error message",
                Success = false
            });
        }
Esempio n. 3
0
        /*
         * This function is for updatig user or equal to add a new seller into system
         */
        internal ServiceResult AddAccount(AccountCreateViewModel vm)
        {
            ABUserModel abuserModel = new ABUserModel();

            abuserModel.Alias    = vm.Alias;
            abuserModel.Email    = vm.EmailAddress;
            abuserModel.Password = vm.Password;
            abuserModel.Token    = null;

            ABUser currentUser = GetUserByUserName(vm.EmailAddress);

            currentUser.Alias    = vm.Alias;
            currentUser.Password = vm.Password;
            currentUser.Token    = null;

            _userRepository.Update(currentUser);


            bool commitSuccess = UpdateUser(currentUser);

            if (commitSuccess)
            {
                return(new ServiceResult()
                {
                    Success = true,
                    Params = currentUser.ToString()
                });
            }

            return(new ServiceResult()
            {
                ErrorMessage = "Error message",
                Success = false
            });
        }