view SilverlightExampleApp/SilverlightExampleApp.Web/Factories/CountryFactory.cs @ 100:9b6855dc165e

Updated System.Windows into Libs
author stevenhollidge <stevenhollidge@hotmail.com>
date Sat, 05 May 2012 23:04:16 +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);
        }
    }
}