using Common.Library; using Gready_Poang.EntityLayer; using System.Collections.ObjectModel; namespace Gready_Poang.ViewModelLayer; public class MethodSharingService : ViewModelBase, IMethodSharingService { private readonly IRepository _repository; public MethodSharingService(IRepository repository) { _repository = repository; } public ObservableCollection Get() { ObservableCollection _participantList = new(); if (_repository != null) { var participantsTask = _repository.Get(); var participants = participantsTask is Task> task ? task.GetAwaiter().GetResult() : (IEnumerable)participantsTask; foreach (var participant in participants) { if (!_participantList.Any(p => p.ParticipantId == participant.ParticipantId)) { _participantList.Add(participant); } } } return _participantList; } }