示例#1
0
        public Task <IResult <string> > SignInAsync(SignInModel signInModel)
        {
            var validation = new SignInModelValidator().Valid(signInModel);

            if (!validation.Success)
            {
                return(Task.FromResult(validation));
            }

            var signedInModel = UserRepository.SignInAsync(signInModel).Result;

            validation = new SignedInModelValidator().Valid(signedInModel);

            if (!validation.Success)
            {
                return(Task.FromResult(validation));
            }

            var userLogModel = new UserLogModel(signedInModel.UserId, LogType.Login);

            UserLogDomain.AddAsync(userLogModel);

            var jwt = CreateJwt(signedInModel);

            return(new SuccessResult <string>(jwt).ToTask());
        }
示例#2
0
        public Task SignOutAsync(SignOutModel signOutModel)
        {
            var userLogModel = new UserLogModel(signOutModel.UserId, LogType.Logout);

            return(UserLogDomain.AddAsync(userLogModel));
        }
示例#3
0
        private async Task AddUserLogAsync(long userId, LogType logType)
        {
            var userLogModel = new UserLogModel(userId, logType);

            await UserLogDomain.AddAsync(userLogModel);
        }