/// <summary> /// Add new instance of comment in database. /// </summary> /// <param name="comment"></param> public void Create(CommentEntity comment) { if (comment == null) throw new ArgumentNullException(nameof(comment)); repository.Create(comment.ToDalComment()); uow.Commit(); }
public ActionResult CreateComment(string commentText, int contentId) { var comment = new CommentEntity() { Date = DateTime.Now, Text = commentText, User = _userService.GetUserEntity(User.Identity.Name), ContentId = contentId }; _contentService.Create(comment); if (Request.IsAjaxRequest()) { return PartialView("_Comments", _contentService.GetContentById(contentId).ToContentViewModel().Comments.OrderBy(x => x.Date)); } return RedirectToAction("Content", new { id = contentId }); }
public void Update(CommentEntity comment) { contentRepository.UpdateComment(comment.ToDalComment()); uow.Commit(); }
public void Create(CommentEntity comment) { contentRepository.AddComment(comment.ToDalComment()); uow.Commit(); }
public ActionResult EditComment(int id, string text) { CommentEntity comment = new CommentEntity() { Id = id, Text = text }; _contentService.Update(comment); if (Request.IsAjaxRequest()) { var temp = _contentService.GetContentById(comment.ContentId).ToContentViewModel().Comments; return PartialView("_Comments", temp); } return RedirectToAction("Content", new { id = comment.ContentId }); }