Beispiel #1
0
        public async Task <GetPersonsResponseDto> GetItemsAsync(GetPersonsRequestDto request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("PersonService  GetPersonListRequest is invalid");
            }

            request.PageSize = (request.PageSize == 0) ? RepositoryDefaults.PageSize : request.PageSize;
            var resp = new GetPersonsResponseDto();

            try
            {
                resp.Persons = mapper.Map <List <PersonDto> >(
                    await personDao.GetItemsAsync(request.PageNo, request.PageSize)
                    );
                resp.Count = await personDao.CountAsync();

                //just for test
                personPublisher.PublishEvent(new PersonCreate()
                {
                    Id = 1
                });
            }
            catch (Exception e) { resp.AddMessage(new Message(e.Message)); }

            return(resp);
        }
 public Task <GetPersonsResponseDto> GetPersonsAsync(GetPersonsRequestDto getPersonsRequestDto)
 {
     return(GetAsync <GetPersonsResponseDto>(
                $"/api/person/?json={{pageNo: {getPersonsRequestDto.PageNo} ,pageSize:{getPersonsRequestDto.PageSize}}}"));
 }
 public async Task <GetPersonsResponseDto> Get([FromQuery] GetPersonsRequestDto request)
 {
     return(await personService.GetItemsAsync(request));
 }
 public Task <GetPersonsResponseDto> Get([FromQuery] GetPersonsRequestDto request)
 {
     return(personApiClient.GetPersonsAsync(request));
 }