using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Telerik.OpenAccess;
using Telerik.OpenAccess.Query;
using _1_Model;

namespace _5A_WCFService
{
  public class Service1 : IService1
  {
    public List<Category> GetCategories()
    {
      var result = from category in NorthwindProvider.ObjectScope().Extent<Category>()
                   select category;

      //Category cat = new Category();
      //cat.CategoryID = 9999;
      //cat.CategoryName = "test";
      //Product prod = new Product();
      //prod.CategoryID = 123;
      //prod.ProductName = "Test";
      //cat.Products.Add(prod);
      //List<Category> categories = new List<Category> { cat };
      
      List<Category> temp = result.ToList<Category>();
      return temp; //new List<Category> { category }; 
    }
  }
}
