Grid bind in mvc but append only new data at grid bind.

Dec 13, 2013 at 11:46 AM
Edited Dec 16, 2013 at 4:09 AM
I have started recently to work on MVC.
I have a task for chat(question - answer) window, i have used a webgrid and binding it at HttpGet Action also refreshing it with in 5 sec time period. its done. But.
My issue is that how to append only those chat queries which are not answered. but every time at grid bind it hits the DB and bind all records.
I want to bind the new records to grid only not all records at every hit.
I am using mvc 4 (razor).

Any one can help?.. please post ..

Dec 18, 2013 at 4:38 PM
Edited Dec 18, 2013 at 4:38 PM

You can filter your questions before pass the collection to the grid, like
        public ActionResult Index()
            var items = repository.GetAll().Where( i=> !i.Answered);
            return View(items);