예제 #1
0
        public object Get(AddressHistoryRequest request)
        {
            var accountId = new Guid(this.GetSession().UserAuthId);

            var addresses = _dao.FindHistoricByAccountId(accountId);

            var historyAddresses = from address in addresses
                                   select new Address()
            {
                Id           = address.Id,
                FriendlyName = address.FriendlyName,
                StreetNumber = address.StreetNumber,
                Street       = address.Street,
                City         = address.City,
                ZipCode      = address.ZipCode,
                State        = address.State,
                FullAddress  = address.FullAddress,
                Longitude    = address.Longitude,
                Latitude     = address.Latitude,
                Apartment    = address.Apartment,
                RingCode     = address.RingCode,
                BuildingName = address.BuildingName,
                IsHistoric   = address.IsHistoric
            };

            var historyAddressesDistinct = from address in historyAddresses
                                           group address by new { address.DisplayLine1, address.DisplayLine2 } into addressesDist
            select addressesDist.First();

            return(historyAddressesDistinct.Take(MaximumNumberEntriesInHistoryAddressList).ToArray());
        }