public ActionResult ChangeStatusComment(object sender, EventArgs e) { String id = Request.Form["id"]; String PageID = Request.Form["PageID"]; int ID = int.Parse(PageID); foreach (DynamicComment key in DynamicComment.GetComments(ID)) { if (key.IdComment == int.Parse(id)) { if (key.Status == "none") { key.Status = "block"; } else { key.Status = "none"; } key.Save(); break; } } return(Redirect(Request.UrlReferrer.ToString())); }
// Find comment by ID public DynamicComment FindComment(int Id, int PageId) { foreach (DynamicComment key in DynamicComment.GetComments(PageId)) { if (key.IdComment == Id) { return(key); } } return(new DynamicComment()); }