using System;
using System.Collections.Generic;
using System.Data.Services.Common;
using System.Linq;
using System.Web;

namespace SimpleDataServices.Model
{
    [DataServiceKey("Title")]
    public class Post
    {
        public string Title { get; set; }
        public string Content { get; set; }
        public string Author { get; set; }
        public DateTime Published { get; set; }
    }

    public class MovieProvider
    {
        private List<Post> posts = new List<Post>()
            {
                new Post { Author = "JK", Title = "Ssak1", Content = "Baran", Published = DateTime.Now.AddYears(-5) },
                new Post { Author = "JK", Title = "Ssak2", Content = "Kot", Published = DateTime.Now.AddYears(-5) },
                new Post { Author = "JK", Title = "Ptak1", Content = "Bielik", Published = DateTime.Now.AddYears(-5) },
                new Post { Author = "MM", Title = "Auto1", Content = "Ford", Published = DateTime.Now.AddYears(-5) },
                new Post { Author = "MM", Title = "Auto2", Content = "Fiat", Published = DateTime.Now.AddYears(-5) },
                new Post { Author = "MM", Title = "Auto3", Content = "Warszawa", Published = DateTime.Now.AddYears(-5) },
                new Post { Author = "MM", Title = "Miasto1", Content = "Warszawa", Published = DateTime.Now },
            };

        public IQueryable<Post> Posts
        {
            get { return posts.AsQueryable(); }
        }
    }
}