using Microsoft.Extensions.Options; using OFBButte.Application.Configuration; using OFBButte.Application.Database; using OFBButte.Application.Email; using OFBButte.Application.Users; using OFBButte.Infrastructure.Hashing; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace OFBButte.Console { public class App { private readonly AppSettings appSettings; private readonly IEmailSender emailSender; private readonly IOFBContext context; private string user = "djabsher@gmail.com"; private string pass = "my password"; public App(IOptions appSettings, IOFBContext context, IEmailSender emailSender) { this.appSettings = appSettings.Value; this.emailSender = emailSender; this.context = context; } public async Task Run() { var env = appSettings.Environment; try { await SendVerificationEmail(); } catch (Exception ex) { throw ex; } } private void AddUser() { var adder = new AddUser(context, new PasswordHasher()); var result = adder.Handle(user, pass); } private async Task SendVerificationEmail() { var adder = new SendEmailValidation(context, emailSender, new Infrastructure.Codes.CodeGenerator()); await adder.Handle(user); } private void LoginUser() { var login = new LoginUser(context, new PasswordHasher()); var result = login.Handle(user, pass); } } }