public void DeleteAddress(string organizationId, string addressId) { var organization = _organizationDomainService.GetOrganizationEntityById(organizationId); if (organization == null) { return; } var address = GetOrganizationAddress(organization.OrganizationEntity, new Guid(addressId)); address?.Address?.Delete(); }
public OrganizationModel GetCurrentUserOrganization() { var currentOrganization = _organizationDomainService.GetCurrentUserOrganizationEntity(); if (currentOrganization == null) { return(null); } if (currentOrganization.ParentOrganizationId == Guid.Empty) { return(new OrganizationModel(currentOrganization)); } var parentOrganization = _organizationDomainService.GetOrganizationEntityById(currentOrganization.ParentOrganizationId.ToString()); return(new OrganizationModel(currentOrganization) { ParentOrganization = new OrganizationModel(parentOrganization) }); }
public List <ContactViewModel> GetContactsByOrganizationId(string organizationId) { var currentOrganization = _organizationDomainService.GetOrganizationEntityById(organizationId); if (currentOrganization == null) { return(new List <ContactViewModel>()); } var organizationUsers = _customerDomainService.GetContactsForOrganization(currentOrganization.OrganizationEntity); if (currentOrganization.SubOrganizations.Count > 0) { foreach (var subOrg in currentOrganization.SubOrganizations) { var contacts = _customerDomainService.GetContactsForOrganization(subOrg.OrganizationEntity); organizationUsers.AddRange(contacts); } } return(organizationUsers.Select(user => new ContactViewModel(user)).ToList()); }