public async Task Execute(AuthenticationInput input) { var client = await _clientRepository.GetUserByCredentials( input.Login, CryptUtils.EncryptPassword(input.Password) ); if (client == null) { return; } _outputHandler.Standard(new AuthenticationOutput( client.Id, client.Name, client.Surname, client.Email, client.PhoneNumber, "")); }
public async Task Execute(CreateClientInput input) { if (input == null) { _outputHandler.Error("Input is null."); return; } var client = new User() { Name = input.Name, Surname = input.Surname, PhoneNumber = input.PhoneNumber, Email = input.Email, Password = CryptUtils.EncryptPassword(input.Password), Role = Role.Client }; await _clientRepository.Register(client); var createClientOutput = new CreateClientOutput(client.Name, client.Surname, client.PhoneNumber, client.Email); _outputHandler.Standard(createClientOutput); }
public override void Up() { Execute.Sql("ALTER TABLE client RENAME TO users;"); Insert.IntoTable("users").Row(new { id = (int)DateTimeOffset.Now.ToUnixTimeSeconds(), name = "Alex", surname = "Ch", email = "*****@*****.**", password = CryptUtils.EncryptPassword("admin"), phonenumber = "11111111111", role = (int)Role.Admin }) .Row(new { id = (int)DateTimeOffset.Now.AddYears(1).ToUnixTimeSeconds(), name = "Vlad", surname = "Grush", email = "*****@*****.**", password = CryptUtils.EncryptPassword("admin"), phonenumber = "11111111111", role = (int)Role.Admin }); }