public JsonResult GetChartData()
        {
            Random rnd  = new Random();
            var    item = new DAL.BlogRepository()
                          .GetAll()
                          .Select(x => new object[] { x.Description, rnd.Next(10) }).ToArray();

            //return Json(item, "", Encoding.UTF8 ,JsonRequestBehavior.AllowGet );

            return(Json(item, JsonRequestBehavior.AllowGet));
        }
        public ActionResult BlogList()
        {
            var item = new DAL.BlogRepository()
                       .GetAll()
                       .Select(x => new Blog()
            {
                Id = x.Id, Description = x.Description, PublishDate = x.PublishDate
            });

            return(PartialView("PartialBlogList", item));
        }
        public ActionResult Index()
        {
            var items = new DAL.BlogRepository()
                        .GetAll()
                        .Select(x => new Blog()
            {
                Id = x.Id, Description = x.Description, PublishDate = x.PublishDate
            });

            return(View(items));
        }
        public ActionResult Edit(int id)
        {
            var item = new DAL.BlogRepository()
                       .GetAll().Where(x => x.Id == id)
                       .Select(x => new Blog()
            {
                Id = x.Id, Description = x.Description, PublishDate = x.PublishDate
            })
                       .FirstOrDefault();

            return(PartialView("Edit", item));
        }
        public ActionResult Edit(Blog model)
        {
            TryValidateModel(model);
            if (ModelState.IsValid)
            {
                var item = new DAL.BlogRepository()
                           .GetAll().Where(x => x.Id == model.Id).FirstOrDefault();
                item.Description = model.Description;
                item.PublishDate = model.PublishDate;

                if (Request.IsAjaxRequest())
                {
                    return(new EmptyResult());
                }
                else
                {
                    return(View("Index"));
                }
            }
            else
            {
                return(View("Error"));
            }
        }