Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Repository
- {
- private static readonly IList<Place> Places = new List<Place>
- {
- new Place(0, "Pastini Pastaria", "Lunch", "Dinner", "Pasta", "Beer", "Wine"),
- new Place(1, "Deschutes Brewery", "Lunch", "Dinner", "Pasta", "Beer", "Wine"),
- new Place(2, "Stumptown Coffee", "Breakfast", "Coffee"),
- new Place(3, "Voodoo Doughnuts", "Breakfast", "Coffee"),
- new Place(4, "J Cafe", "Breakfast", "Lunch", "Coffee"),
- };
- public void AddPlace(string name, params string[] tags)
- {
- var id = Places.Any()? Places.Max(x=>x.Id) + 1 : 0;
- var place = new Place(id, name,tags);
- Places.Add(place);
- }
- public ReadOnlyCollection<Place> GetPlaces()
- {
- return new ReadOnlyCollection<Place>(Places);
- }
- public Place GetPlace(int id)
- {
- return Places.SingleOrDefault(x=>x.Id == id);
- }
- }
Add Comment
Please, Sign In to add comment