annotate SilverlightExampleApp/SilverlightExampleApp.Web/Factories/TitleFactory.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
rev   line source
49
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
1 using System.Collections.Generic;
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
2 using System.Linq;
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
3 using SilverlightExampleApp.Interfaces.Models;
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
4 using SilverlightExampleApp.Web.Models;
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
5
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
6 namespace SilverlightExampleApp.Web.Factories
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
7 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
8 public class TitleFactory
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
9 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
10 private readonly static IList<ITitle> _titles = new List<ITitle>(7)
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
11 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
12 new Title() {Id = 1, Description = "Mr"},
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
13 new Title() {Id = 2, Description = "Miss"},
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
14 new Title() {Id = 3, Description = "Mrs"},
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
15 new Title() {Id = 4, Description = "Ms"},
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
16 new Title() {Id = 5, Description = "Master"},
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
17 new Title() {Id = 6, Description = "Sir"},
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
18 new Title() {Id = 7, Description = "Dr"}
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
19 };
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
20 public static IList<ITitle> GetAll()
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
21 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
22 return _titles;
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
23 }
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
24
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
25 public static ITitle Get(int id)
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
26 {
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
27 return _titles.FirstOrDefault(t => id == t.Id);
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
28 }
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
29 }
502f5f365649 Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff changeset
30 }