Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "parsyegl"

I have a problem retrieving the ID of a newly created user in the CreateUser task of the UserAppService. It seems that the new user in the database is not created before the CreateUser task was left. Any ideas on how to get the ID in order to do some further processing?

public async Task CreateUser(CreateUserInput input)
        {
            var user = input.MapTo<User>();

            user.UserName = user.UserName.Trim();
            user.EmailAddress = user.EmailAddress.Trim();
            user.TenantId = AbpSession.TenantId;
            user.Password = new PasswordHasher().HashPassword(input.Password);
            user.IsEmailConfirmed = false;
            user.SetNewEmailConfirmationCode();

            CheckErrors(await UserManager.CreateAsync(user));
            // user.Id is still 0 here

            var newUser = UserManager.FindByEmail(user.EmailAddress.Trim());
            // newUser == null

            //User is not created in DB before CreateUser task is left
        }

Hello everyone,

I just started to create a new application using ABP. My last ASP.NET application is quite a while in the past, so I first started with some AngularJS tutorials to learn some of the basics. Anyway, I feel a bit like an absolute beginner, because web development seems to have changed a lot over last few years. So please have some patience if I ask some silly questions. ;)

I tried to add a new entry called 'Reports' to the menu and created a reports.cshtml and reports.js file for that page accordingly in /App/Main/views/reports.

I updated the main menu in AppNavigationProvider.cs like this:

public override void SetNavigation(INavigationProviderContext context)
        {
            context.Manager.MainMenu
                .AddItem(
                    new MenuItemDefinition(
                        "Home",
                        new LocalizableString("HomePage", AppConsts.LocalizationSourceName),
                        url: "#/",
                        icon: "fa fa-home"
                        )
                ).AddItem(
                    new MenuItemDefinition(
                        "Tenants",
                        L("Tenants"),
                        url: "#tenants",
                        icon: "fa fa-globe",
                        requiredPermissionName: PermissionNames.Pages_Tenants
                        )
                ).AddItem(
                    new MenuItemDefinition(
                        "Users",
                        L("Users"),
                        url: "#users",
                        icon: "fa fa-users",
                        requiredPermissionName: PermissionNames.Pages_Users
                        )
               ).AddItem(
                    new MenuItemDefinition(
                        "Reports",
                        new LocalizableString("Reports", AppConsts.LocalizationSourceName),
                        url: "#/reports",
                        icon: "fa fa-line-chart"
                        )
                ).AddItem(
                    new MenuItemDefinition(
                        "About",
                        new LocalizableString("About", AppConsts.LocalizationSourceName),
                        url: "#/about",
                        icon: "fa fa-info"
                        )
                );
        }

and the app.js file like this:

$stateProvider
                .state('home', {
                    url: '/',
                    templateUrl: '/App/Main/views/home/home.cshtml',
                    menu: 'Home' //Matches to name of 'Home' menu in AppNavigationProvider
                })
                .state('reports', {
                    url: '/reports',
                    templateUrl: '/App/Main/views/reports/reports.cshtml',
                    menu: 'Reports' //Matches to name of 'Reports' menu in AppNavigationProvider
                })
                .state('about', {
                    url: '/about',
                    templateUrl: '/App/Main/views/about/about.cshtml',
                    menu: 'About' //Matches to name of 'About' menu in AppNavigationProvider
                });

The new menu item is displayed on the page, but instead of opening /#/reports it opens the root page at /#/. The about menu item is still working as expected.

What am I doing wrong? Is there any other place that needs to be adapted?

Thanks for your help!

Showing 1 to 2 of 2 entries