public JsonResult Post(string id, string dop)
 {
     JsonResult rez = new JsonResult();
     Post pst = new Post() { IsCommentable = true, IsShowInfo = true };
     if (id != null) {
         int ids = int.Parse(id);
         pst = con.Posts.Where(p => p.Id == ids).FirstOrDefault();
     }
     rez.Data = RenderPartialViewToString("Post", pst);
     return rez;
 }
 public JsonResult PostSave(Post post)
 {
     JsonResult rez = new JsonResult();
     if (!ModelState.IsValid) {
         foreach (var item in ModelState.Keys)
             for (int i = 0; i < ModelState[item].Errors.Count; i++)
                 rez.Data += ModelState[item].Errors[i].ErrorMessage + "<br />";
         return rez;
     }
     post.Text = Uploader.Parce(post.Text);
     post.WebLink = Uploader.ParceLink(post.Title);
     int id = con.Users.Where(u => u.Login == User.Identity.Name).FirstOrDefault().Id;
     post.UserId = id;
     if (post.Id == 0)
         con.Posts.Add(post);
     else
         con.Entry(post).State = System.Data.EntityState.Modified;
     con.SaveChanges();
     if (post.InCatMenu)
         MenuHelper.UpdateCache();
     rez.Data = "Статья успешно сохранена.;" + post.Id;
     return rez;
 }
 public ActionResult Post(string id)
 {
     Post pst = new Post() { IsCommentable = true, IsShowInfo = true };
     if (id != null) {
         int ids = int.Parse(id);
         pst = con.Posts.Where(p => p.Id == ids).FirstOrDefault();
     }
     return View(pst);
 }