Mercurial > silverbladetech
view SilverlightExampleApp/SilverlightExampleApp.Web/Factories/CountryFactory.cs @ 60:fc62c971a117
upload to blog
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Sat, 21 Apr 2012 21:19:39 +0100 |
parents | 502f5f365649 |
children |
line wrap: on
line source
using System.Collections.Generic; using System.Linq; using SilverlightExampleApp.Interfaces.Models; using SilverlightExampleApp.Web.Models; namespace SilverlightExampleApp.Web.Factories { public class CountryFactory { private readonly static IList<ICountry> _countries = new List<ICountry>(7) { new Country() {Id = 1, Description = "England"}, new Country() {Id = 2, Description = "France"}, new Country() {Id = 3, Description = "Germany"}, new Country() {Id = 4, Description = "Italy"}, new Country() {Id = 5, Description = "Scotland"}, new Country() {Id = 6, Description = "Spain"}, new Country() {Id = 7, Description = "Wales"} }; public static IList<ICountry> GetAll() { return _countries; } public static ICountry Get(int id) { return _countries.FirstOrDefault(t => id == t.Id); } } }