using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
using KendoUISignalR.Models;

namespace KendoUISignalR.Hubs
{
    public class ChatHub : Hub
    {
        public IEnumerable<ProductViewModel> Read()
        {
            using (var northwind = new NorthwindEntities())
            {
                return northwind.Products.Select(p => new ProductViewModel
                {
                    ProductID = p.ProductID,
                    ProductName = p.ProductName
                }).ToList();
            }
        }

        public void Update(ProductViewModel product)
        {
            Clients.Others.update(product);
        }

    }
}