0
pointlevel created
Hello!
How can i do to show the name of current organizationUnit in the top of the page. Extending the "TenantName/UserName"-info that is prebuilt. I know that a user by default can be part of multiple organizations, but lets just pull out the first one.
Thanks in advance!
2 Answer(s)
-
0
For MVC project;
Create a new application service and write the method below. On the client
public async Task<GetUserOrganizationOutput> GetUserNotifications() { var userIdentifier = new UserIdentifier(AbpSession.TenantId, AbpSession.UserId.Value); var organizationUnits= AsyncHelper.RunSync(() => UserManager.GetOrganizationUnitsAsync(UserManager.GetUser(userIdentifier))); var firstOrganization = organizationUnits.FirstOrDefault(); if (firstOrganization != null) { //you have to map firstOrganization to dto and send the dto to client. return new GetUserOrganizationOutput() {Organization = firstOrganization}; } return null; }
If you are using MVC project, Call this application service in _Header.js and set to html with jquery. If you are using angular, you can call the service from header.component.ts
-
0
Thanks a lot! Works like a charm :D