Exemple #1
0
            public async Task <ProfileDto> Handle(Query request, CancellationToken cancellationToken)
            {
                var profile = await _profileRepository.Table.FirstOrDefaultAsync(p => p.ProfileId == request.Id, cancellationToken);

                if (profile == null)
                {
                    return(null);
                }

                var profileAsDto = _dtoHelper.PrepareProfileDto(profile);

                return(profileAsDto);
            }
Exemple #2
0
            public Task <IList <ProfileDto> > Handle(Query request, CancellationToken cancellationToken)
            {
                var query = GetProfileQuery(request.Ids);

                if (request.SinceId > 0)
                {
                    query = query.Where(profile => profile.Id > request.SinceId);
                }

                IList <Profile> profiles = new ApiList <Profile>(query, request.Page - 1, request.Limit);

                IList <ProfileDto> profilesAsDto = profiles.Select(profile => _dtoHelper.PrepareProfileDto(profile)).ToList();

                return(Task.FromResult(profilesAsDto));
            }