Im using angular 16 and .net core 7 version. When i send request to back-end, i can handle. But i have a problem.
Let's assume we have two tables: roles and users. In Angular, there's a grid where I display the roles. I'm having issues on the backend side when applying filtering in that grid.
[HttpPost]
public async Task<IActionResult> GetAllUser([DataSourceRequest] DataSourceRequest filter)
{
var result = await this.userService.GetAllUser(filter);
return CreateActionResultInstance(result);
}
public async Task<DataSourceResult> GetAllUser(DataSourceRequest filter)
{
var result = await entity
.AsNoTracking()
.IgnoreQueryFilters()
.Include(y => y.Roles)
.Select(x => new UserViewModel
{
Idx = x.Idx,
Email = x.Email,
Name = x.Name,
Phone = x.Phone,
Surname = x.Surname,
UserName = x.UserName,
Roles = x.Roles.Select(x => x.Idx)
}).ToDataSourceResultAsync(filter);
return result;}
What I need here is for the filtering to work when a role is selected as a filter in the user list on the screen. How can we use a many-to-many table in this case? I researched a lot but couldn't find anything online.