Beispiel #1
0
 public async Task <IEnumerable <FamilleListItem> > ExecuteQueryAsync()
 {
     if (s_Cache.IsEmpty)
     {
         s_Cache = new ConcurrentBag <string>((await _familleRepository.GetAllFamillesAsync().ConfigureAwait(false)).Select(f => f.Nom));
     }
     return(s_Cache.Select(v => new FamilleListItem {
         Nom = v
     }));
 }
        public async Task <Result> HandleAsync(CreerFamilleCommand command, ICommandContext context = null)
        {
            Famille._nomFamilles = (await _familleRepository.GetAllFamillesAsync().ConfigureAwait(false)).Select(f => new NomFamille(f.Nom)).ToList();
            var result = Famille.CreerFamille(command.Nom);

            if (result && result is Result <NomFamille> resultFamille)
            {
                await CoreDispatcher.PublishEventAsync(new FamilleCreee(resultFamille.Value));

                return(Result.Ok());
            }
            return(result);
        }