view SilverlightExampleApp/SilverlightExampleApp.Web/Factories/CountryFactory.cs @ 62:810116cd6b8e

ErrorWindow working
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sun, 22 Apr 2012 09:01:20 +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);
        }
    }
}