Closed daskabe closed 10 months ago
I can't reproduce such a problem with a default application.
Also the generated code is correct (this is how Entity Framework maps related entities). If you have a Radzen Blazor Studio subscription you can send us your app to info@radzen.com so we can troubleshoot.
I dont have subscription - yet :).
Can you confirm my back code for AddApplicationUser.razor.cs has everything?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.JSInterop;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Radzen;
using Radzen.Blazor;
namespace TestApp.Pages
{
public partial class AddApplicationUser
{
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected NavigationManager NavigationManager { get; set; }
[Inject]
protected DialogService DialogService { get; set; }
[Inject]
protected TooltipService TooltipService { get; set; }
[Inject]
protected ContextMenuService ContextMenuService { get; set; }
[Inject]
protected NotificationService NotificationService { get; set; }
protected IEnumerable<TestApp.Models.ApplicationRole> roles;
protected TestApp.Models.ApplicationUser user;
protected IEnumerable<string> userRoles = Enumerable.Empty<string>();
protected string error;
protected bool errorVisible;
[Inject]
protected SecurityService Security { get; set; }
protected override async Task OnInitializedAsync()
{
user = new TestApp.Models.ApplicationUser();
roles = await Security.GetRoles();
}
protected async Task FormSubmit(TestApp.Models.ApplicationUser user)
{
try
{
user.Roles = roles.Where(role => userRoles.Contains(role.Id)).ToList();
await Security.CreateUser(user);
DialogService.Close(null);
}
catch (Exception ex)
{
errorVisible = true;
error = ex.Message;
}
}
protected async Task CancelClick()
{
DialogService.Close(null);
}
}
}
Hello, created new security using ASP.NET Core identity.
I created roles![image](https://github.com/radzenhq/radzen-blazor-studio/assets/94478096/a2eecacf-733d-41f5-bff4-33ff231dc498)
then tried to create user - on the dilaog the role dropdown does not allow selection![chrome_4DG34QZlJF](https://github.com/radzenhq/radzen-blazor-studio/assets/94478096/ca82aeb2-1080-43fd-aa3a-de098a2b279b)
This generated code is suspect
Shouldn't it be
This is where its getting called![image](https://github.com/radzenhq/radzen-blazor-studio/assets/94478096/af9615a7-fd62-4c24-a172-3433f2ab5a80)