using System.Linq;
using System.Web.Mvc;
using System.Collections.Generic;
using Models;
using System;
using Telerik.Web.Mvc.UI;
using Telerik.Web.Mvc;

namespace TelerikMvcApplication1.Controllers
{



    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult About()
        {
            return View();
        }



        private List<PostComment> getRecords()
        {

            List<PostComment> l = new List<PostComment>();
            l.Add(new PostComment { postCommentId = 1, lastCommentDate = DateTime.Now, simpleDate=DateTime.Now });
            return l;
        }
       
        [GridAction]
        public ActionResult _SelectPostCommentEditing()
        {
            
            return View(new GridModel(getRecords()));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        //[CultureAwareAction]
        [GridAction]
        public ActionResult _SavePostCommentEditing(int id)
        {
            
            PostComment product = getRecords()[0];

            TryUpdateModel(product);

            

            return View(new GridModel(getRecords()));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        //[CultureAwareAction]
        [GridAction]
        public ActionResult _InsertPostCommentEditing()
        {
            //Create a new instance of the EditableProduct class.
            PostComment product = new PostComment();
            
            //Perform model binding (fill the product properties and validate it).
            if (TryUpdateModel(product))
            {
               
            }

            //Rebind the grid
            return View(new GridModel(getRecords()));
        }


        [AcceptVerbs(HttpVerbs.Post)]
        [GridAction]
        public ActionResult _DeletePostCommentEditing(int id)
        {
           

            //Rebind the grid
            return View(new GridModel(getRecords()));
        }


    }
}
