view SilverlightExampleApp/SilverlightExampleApp.Web/Factories/CountryFactory.cs @ 49:502f5f365649

Initial load for Silverlight Example Application
author Steven Hollidge <stevenhollidge@hotmail.com>
date Tue, 17 Apr 2012 17:57:52 +0100
parents
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);
        }
    }
}