@using Common.Dtos.Group @using HushianWebApp.Service @inject GroupService groupService; @if (!Spinnervisible) {
@item.Name }
@code { private string? GroupName; private bool Spinnervisible = false; [Parameter] public int ExperID { get; set; } public List Groups { get; set; } = new(); public List CoGroups { get; set; } = new(); protected override async Task OnParametersSetAsync() { Spinnervisible = true; Groups = await groupService.GetGroupsFromExperID(ExperID); Spinnervisible = false; await base.OnParametersSetAsync(); } } @functions { private async Task> DataProvider(AutoCompleteDataProviderRequest request) { CoGroups = await groupService.GetGroupsCompany(); return await Task.FromResult(new AutoCompleteDataProviderResult { Data = CoGroups.Where(w => w.Name.Contains(request.Filter.Value)), TotalCount = CoGroups.Count() }); } private async Task OnAutoCompleteChanged(Read_GroupDto group) { Spinnervisible = true; if (group != null && !Groups.Any(a => a.ID == group.ID) && await groupService.JoinExperToGroup(group.ID, ExperID)) Groups.Add(group); Spinnervisible = false; } async Task UnJoin(Read_GroupDto group) { Spinnervisible = true; if (group != null && await groupService.UnJoinExperToGroup(group.ID, ExperID)) Groups.Remove(group); Spinnervisible = false; } }