Esempio n. 1
0
        public SessionModel AuthorizeUser([FromBody] UserAuthInputModel userAuthInputModel)
        {
            var user = _authorizeUserService.AuthorizeUser(
                userAuthInputModel.Username,
                userAuthInputModel.Password
                );

            var session = _createSessionService.CreateNewSession(
                user.Id
                );

            var getUserId = _createWalletService.GetUserId(user.Id);

            if (getUserId == null)
            {
                var wallet = _createWalletService.InsertFirstDeposit(user.Id, user.Username);
            }

            return(new SessionModel
            {
                Id = session.Id,
                UserId = session.UserId,
                CreatedDate = session.CreatedDate
            });
        }
        public SessionModel PostNewUser([FromBody] UserInputModel userInputModel)
        {
            var user = _createNewUserService.CreateNewUser(
                userInputModel.Username,
                userInputModel.Password

                );

            var session = _createSessionService.CreateNewSession(
                user.Id
                );

            var wallet = _createWalletService.InsertFirstDeposit(
                user.Id, user.Username
                );


            return(new SessionModel
            {
                Id = session.Id,
                UserId = session.UserId,
                CreatedDate = session.CreatedDate
            });
        }