public int CreateDay1(CreateTenantModel domainModel) { var username = ClaimsPrincipal.Current.Identity.SplitName(); // Create repositories var tenantRepository = new TenantRepository(); var userAccountRepository = new UserAccountRepository(); var creditCardRepository = new CreditCardRepository(); // Get the User var user = userAccountRepository.Fetch(username); // Create the Tenant var tenantId = tenantRepository.Create(user.UserAccountId, domainModel.Tenant); // Create the CreditCard if (!string.IsNullOrEmpty(domainModel.CreditCard.CreditCardNumber)) { creditCardRepository.Insert(tenantId, domainModel.CreditCard); } // Update the User userAccountRepository.UpdatePesonalDetails(username, domainModel.UserAccount.Firstname, domainModel.UserAccount.Lastname); return tenantId; }
public List<TenantModel> FetchTenants() { // Create repository var tenantRepository = new TenantRepository(); // FetchById the themes var tenants = tenantRepository.FetchAll(); return tenants; }
public List<TenantModel> FetchByUsername(string username) { // Create repository var tenantRepository = new TenantRepository(); // Find the tenant var tenants = tenantRepository.FetchByUsername(username); return tenants; }
public TenantModel FetchByTenantId(int tenantId) { // Create repository var tenantRepository = new TenantRepository(); // Find the tenant var tenant = tenantRepository.FetchById(tenantId); return tenant; }
public int DeleteTenant(string username) { // Create repositories var tenantRepository = new TenantRepository(); // Update the Tenant var rowsAffected = tenantRepository.Delete(username); return rowsAffected; }
public int SetProvisioningStatus(int tenantId, bool azureServicesProvisioned) { // Create repositories var tenantRepository = new TenantRepository(); // Update the Tenant var rowsAffected = tenantRepository.SetProvisioningStatus(tenantId, azureServicesProvisioned); return rowsAffected; }
public int CreateDay2(CreateTenantModel domainModel) { var username = ClaimsPrincipal.Current.Identity.SplitName(); // Create repositories var tenantRepository = new TenantRepository(); var userAccountRepository = new UserAccountRepository(); // Get the User var user = userAccountRepository.Fetch(username); // Create the Tenant var tenantId = tenantRepository.Create(user.UserAccountId, domainModel.Tenant); return tenantId; }