protected override async Task <InputModel> CreateInputModelAsync(RegisterProviderContext context) { return(new InputModel { Affiliations = await context.ListAffiliationsAsync(false), Categories = await context.ListCategoriesAsync(false), }); }
protected override async Task <InputModel> CreateInputModelAsync(RegisterProviderContext context) { var studentStore = context.GetRequiredService <IStudentStore>(); var userId = int.Parse(context.User.GetUserId() !); IEnumerable <int> tenantId = context.User.IsInRole("Administrator") ? context.GetRequiredService <IAffiliationStore>().GetQueryable().Select(a => a.Id) : context.User.FindAll("tenant_admin").Select(a => int.Parse(a.Value)); return(new InputModel { Classes = await studentStore.ListClassesAsync(tenantId, c => c.UserId == null || c.UserId == userId), Categories = await context.ListCategoriesAsync(false), }); }