public ActionResult AddComment(int listId, ListItemCommentModel model) { var list = listService.GetById(listId); if (list == null || !list.EnabledComments) { return(new HttpNotFoundResult()); } if (ModelState.IsValid && IsValidUrl(model.Website)) { var comment = new ListComment { Name = model.Name, Email = model.Email, Website = model.Website, Comments = model.Comments, ListId = listId, ListItemId = model.ListItemId, CreatedDate = DateTime.UtcNow, IsApproved = list.AutoModeratedComments, IPAddress = ClientIPAddress }; listItemCommentService.Insert(comment); } return(Redirect(Request.UrlReferrer == null ? Url.Content("~/") : Request.UrlReferrer.ToString())); }
public ActionResult Update(ListItemCommentModel model) { if (!CheckPermission(ListsPermissions.ManageLists)) { return(new HttpUnauthorizedResult()); } var comment = commentService.GetById(model.Id); comment.Name = model.Name; comment.Email = model.Email; comment.Website = model.Website; comment.IsApproved = model.IsApproved; comment.Comments = model.Comments; commentService.Save(comment); return(new AjaxResult().NotifyMessage("UPDATE_ENTITY_COMPLETE").CloseModalDialog()); }