view SilverlightExampleApp/SilverlightExampleApp.Web/Factories/CountryFactory.cs @ 118:fa4ba8943048

final version
author stevenh7776
date Sun, 27 May 2012 19:53:23 +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);
        }
    }
}