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()); }
public Task SignOutAsync(SignOutModel signOutModel) { var userLogModel = new UserLogModel(signOutModel.UserId, LogType.Logout); return(UserLogDomain.AddAsync(userLogModel)); }
private async Task AddUserLogAsync(long userId, LogType logType) { var userLogModel = new UserLogModel(userId, logType); await UserLogDomain.AddAsync(userLogModel); }