|
namespace RegiRide.Mappers
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using RegiRide.Model;
using RegiRide.ViewModels;
internal class AddressListMapper
{
public static ObservableCollection<AddressViewModel> Map(List<Address> addressList)
{
var addresses = new ObservableCollection<AddressViewModel>();
foreach (Address address in addressList)
{
addresses.Add(new AddressViewModel(address, WhichAddress.None));
}
return addresses;
}
public static ObservableCollection<AddressViewModel> MapForListPicker(List<Address> addressList)
{
var addresses = new ObservableCollection<AddressViewModel>();
foreach (Address address in addressList)
{
addresses.Add(new AddressViewModel(address, WhichAddress.None));
}
addresses.Insert(0, new AddressViewModel(new Address { Id = Guid.Empty, Name = "Select an address" }, WhichAddress.None));
return addresses;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Patrick Kalkman is a senior Software Architect with more than 20 years professional development experience. He works for
SimpleTechture where he helps teams develop state of the art web applications.
Patrick enjoys writing his
blog. It discusses agile software development. Patrick can be reached at patrick@simpletechture.nl.
Published Windows 8 apps:
Published Windows Phone apps:
Awards:
Best Mobile article of March 2012
Best Mobile article of June 2012