Base solution for your next web application

Activities of "sayas"

Hi Halil,

Thank you for your reply. Can you please share me a sample code for doing the same? Any help will be highly appreciated! Thanks!!

Now I'm using ABP. But, after making a simple application successfully in Abp, I'll move on to AbpZero. Can you please help me on this?

Hi dears,

I want to implement a multi-select list to save an Institution-Course Mapping.

I've produced a ComboBox to select an institution and a Multi-Select List for selecting some courses for the selected institution.

I've made it by creating a ViewModel of both the Institution & Course entities. The ViewModel contains of the ListResultDto's of each entities.

My question is, how can i get the selected values of the multiselect list and save it to the database? Should I use a controller actionmethode or the JavaScript API Itself?? Will be appreciable if you share some sample codes please.. thanks!!

Hi Halil,

I've done as you said. The UserId shown from AbpSession is '1' and TenantId is null. As you know, '1' is the admin UserId.

Repeated the same after including the AbpAuthorize attribute and after giving a user-wise permission in AbpPermissions table. Now also getting the same result.

What to do now??

Oh.. I'm really Sorry.. I've typed it mistakenly. The error is not at the point of creating the new tenant, its happening at the point of Creating a Default Institute for the new Tenant (in TenantAppService).

Another interesting fact is, everything is working perfectly when i remove the [AbpAuthorize(PermissionNames.Pages_Institution)] from InstitutionAppService

But, I've given permission for the same to the admin user role in the table 'AbpPermissions' A screenshot of the same is attached.

PermissionNames

Public const string Pages_Institution = "Pages.Institution";

Hi,

I've created multi-tenant application to manage some institutions. My requirement is - whenever I create a new tenant, an institution should be created automatically. I've created a master for adding the institutions too. And that's working fine.

But when adding a new tenant, an error is occurred at the point of creating a new tenant. The error message shown in the browser was only 'An Internal Error Occurred'. But I got the 'UserId not found' error from the log.

I've given the permissions as well. Following is my code:

Institute Entity

[Table("AbpInstitutions")]
    public class Institution : FullAuditedEntity,IMustHaveTenant
    {
        public int TenantId { get; set; }
        
        [Required]
        [StringLength(50)]
        public string Name { get; set; }

        [StringLength(250)]
        public string Details { get; set; }

        [StringLength(50)]
        public string Caption { get; set; }

        [StringLength(250)]
        public string Logo { get; set; }

        //public ICollection<InstitutionCourseMapping> InstitutionCourseMappings { get; set; }

        public static Institution CreateInstitutionForNewTenant(string tenantName)
        {
            return new Institution
            {    
                Name = tenantName,
                Caption=tenantName,
                Details= "Institution Created by default for Tenant - " + tenantName,
                Logo=""
            };
        }
    }

InstitutionAppService

[AbpAuthorize(PermissionNames.Pages_Institution)]

 public async Task CreateInstitution(Institution input)
        {
            //var institution = input;
            try
            {
                await _institutionRepository.InsertAsync(input);
            }
            catch (Exception ex)
            {
                Trace.Write(ex.Message);
                throw;
            }
        }

TenantAppService

//Create a Default Institute for the new Tenant
                var defaultInstitution = Institution.CreateInstitutionForNewTenant(tenant.Name);
                await _institutionAppService.CreateInstitution(defaultInstitution);

SmartCampusAuthorizationProvider

var instiuionMaster = pages.CreateChildPermission(PermissionNames.Pages_Institution, L("Manage Institutions"), multiTenancySides: MultiTenancySides.Host);

Stack Trace (Got it from [AbpAuditLogs] )

System.InvalidOperationException: UserId not found.     at Microsoft.AspNet.Identity.UserManager`2.&lt;GetRolesAsync&gt;d__ac.MoveNext()  --- End of stack trace from previous location where exception was thrown ---     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)     at Abp.Authorization.Users.AbpUserManager`2.<>c__DisplayClass63_0.<<GetUserPermissionCacheItemAsync>b__0>d.MoveNext() in D:\Halil\GitHub\module-zero\src\Abp.Zero\Authorization\Users\AbpUserManager.cs:line 641  --- End of stack trace from previous location where exception was thrown ---     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)     at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass5_0`2.&lt;&lt;GetAsync&gt;b__0>d.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:line 0  --- End of stack trace from previous location where exception was thrown ---     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)     at Abp.Runtime.Caching.CacheBase.&lt;GetAsync&gt;d__15.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheBase.cs:line 69  --- End of stack trace from previous location where exception was thrown ---     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)     at Abp.Runtime.Caching.CacheExtensions.&lt;GetAsync&gt;d__5`2.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:line 38  --- End of stack trace from previous location where exception was thrown ---     at System.Runtime.CompilerServices.TaskA...

Somebody please help me out.. I'm Stuck here....

Showing 11 to 16 of 16 entries