public IResult <string> SignIn(SignInModel signInModel)
        {
            var signInModelValidator = new SignInModelValidator().Valid(signInModel);

            if (!signInModelValidator.Success)
            {
                return(signInModelValidator);
            }

            var signedInModel = UserRepository.SignIn(signInModel);

            var signedInModelValidator = new SignedInModelValidator().Valid(signedInModel);

            if (!signedInModelValidator.Success)
            {
                return(signedInModelValidator);
            }

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

            UserLogDomain.Save(userLogModel);

            var jwt = CreateJwt(signedInModel);

            return(new SuccessResult <string>(jwt));
        }
        public string SignIn(SignInModel signInModel)
        {
            new SignInModelValidator().ValidateThrow(signInModel);

            TransformLoginAndPasswordToHash(signInModel);

            var signedInModel = UserRepository.SignIn(signInModel);

            new SignedInModelValidator().ValidateThrow(signedInModel);

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

            UserLogDomain.Save(userLogModel);

            return(CreateJwt(signedInModel));
        }
        public void SignOut(SignOutModel signOutModel)
        {
            var userLogModel = new UserLogModel(signOutModel.UserId, LogType.Logout);

            UserLogDomain.Save(userLogModel);
        }