//    public int SortBy {get; set;}


        public static AddressesListDtoResponse Build(List <Address> addresses, string basePath,
                                                     int currentPage, int pageSize, int totalItemCount)
        {
            List <AddressDto> addressDtos = new List <AddressDto>(addresses.Count);

            foreach (var address in addresses)
            {
                addressDtos.Add(AddressDto.Build(address));
            }


            return(new AddressesListDtoResponse
            {
                PageMeta = new PageMeta(addresses.Count, basePath, currentPageNumber: currentPage, requestedPageSize: pageSize,
                                        totalItemCount: totalItemCount),
                Addresses = addressDtos
            });
        }
Exemplo n.º 2
0
        public static AddressDto Build(Address address, bool includeUser = false)
        {
            var dto = new AddressDto
            {
                Id        = address.Id,
                City      = address.City,
                Country   = address.Country,
                ZipCode   = address.ZipCode,
                FirstName = address.FirstName,
                LastName  = address.LastName,
                Address   = address.StreetAddress
            };

            if (includeUser)
            {
                dto.User = UserBasicEmbeddedInfoDto.Build(address.User);
            }
            return(dto);
        }