示例#1
0
        public RentalService()
        {
            _rentalHistory = new ObservableCollection <Rental>(_rentals);

            var owner = new RentalOwner
            {
                Name            = "Jack Nicolson",
                Email           = "*****@*****.**",
                PhoneNumber     = "0201234567",
                Location        = "Los Angeles",
                BannerImageUrl  = "https://static1.sibcycline.com/photos/e0/da/7/e0da76a7fbcd83f59ee3ae32abaed6ad56da2238_1024.jpg",
                ProfileImageUrl = "https://darylh.com/wp-content/uploads/2017/05/Profile-Picture-Square.jpg",
                Rating          = 5,
                ReviewCount     = 1438,
                Languages       = new[] { "English", "Deutsch", "Russian" },
                Description     = "I am Jack and I have 3 apartments for rent short and long term, I invite tenants who appreciate the convenience of use and nice aesthetic interiors."
            };

            var description = Application.Current.Resources["LongDummyText"] as string;

            foreach (var rental in _rentals)
            {
                rental.Owner            = owner;
                rental.Description      = description;
                rental.PropertyChanged += OnRentalPropertyChanged;
            }
        }
示例#2
0
        public async Task <Rental[]> GetRentalsAsync(RentalOwner owner)
        {
            await Task.Delay(2000);

            if (owner == null)
            {
                return(_rentals);
            }
            else
            {
                return(_rentals.Where(r => r.Owner == owner).ToArray());
            }
        }