public int CreateComment(int Id_movie, int Id_user, string Comment1, int Rating) { Comment entity = new Comment(); entity.Id_movie = Id_movie; entity.Id_user = Id_user; entity.Comment1 = Comment1; entity.Rating = Rating; return(commentDao.Create(entity)); }
public ActionResult AddComment(Comment comment) { if (functions.CookieID() == null) { return(Redirect("/Users/Login")); } else if (ModelState.IsValid) { commentDao.Create(comment); return(Json(true, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); }
private Comment CreateTestComment(UserProfile user, Link link, string text, DateTime time) { Comment comment = Comment.CreateComment( TestData.nonExistentCommentId, user.userId, link.linkId, text, Trunk(time)); CommentDao.Create(comment); return(comment); }
/// <exception cref="InstanceNotFoundException"/> public long AddComment(long productId, long userId, string commentBody) { Comment comment = new Comment { comment1 = commentBody, commentDate = System.DateTime.Now, userId = userId, productId = productId }; CommentDao.Create(comment); return(comment.commentId); }
public Comment AddComment(string comment, long eventId, long userId) { Event e = EventDao.Find(eventId); UserProfile u = UserProfileDao.Find(userId); Comment c = new Comment(); c.content = comment; c.Event = e; c.UserProfile = u; c.commentDate = DateTime.Now; c.Labels = new List <Label>(); c.loginName = u.loginName; CommentDao.Create(c); return(c); }
public long AddComment(string userLogin, long sportEventId, string commentDescription, List <String> tags = null) { UserProfile user = CheckUser(userLogin); SportEvent sportEvent = CheckSportEvent(sportEventId); string date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); DateTime dateTime = DateTime.UtcNow.Date; Comment comment = new Comment { ownerId = user.userId, publishDate = DateTime.UtcNow, comment_description = commentDescription, eventId = sportEventId, }; if (tags != null) { foreach (var tag in tags) { String tagLower = tag.ToLower(); if (!TagDao.Exists(tagLower)) { Tag newTag = new Tag { tagName = tagLower }; newTag.Comment.Add(comment); TagDao.Create(newTag); comment.Tags.Add(newTag); } else { Tag tagInDatabase = TagDao.Find(tagLower); comment.Tags.Add(tagInDatabase); tagInDatabase.Comment.Add(comment); } } } CommentDao.Create(comment); return(comment.commentId); }
public long AddComment(long productId, long userId, string commentBody, List <long> tags) { Comment comment = new Comment { comment1 = commentBody, commentDate = System.DateTime.Now, userId = userId, productId = productId }; List <Tag> tagList = new List <Tag>(); foreach (var tagId in tags) { tagList.Add(TagDao.Find(tagId)); } comment.Tags = tagList; CommentDao.Create(comment); return(comment.commentId); }
public ActionResult Add(Comment comment, int articleId) { string articleTitle; if (ModelState.IsValid) { CommentDao cDao = new CommentDao(); ArticleDao aDao = new ArticleDao(); Article article = aDao.GetById(articleId); comment.Article = article; articleTitle = article.Title; comment.IpAddress = Request.UserHostAddress; comment.UserAgent = Request.UserAgent; if (User != null && User.Identity.IsAuthenticated) { User user = Membership.GetUser(User.Identity.Name) as User; comment.AuthorNick = user.Nick; comment.AuthorEmail = user.Email; } cDao.Create(comment); TempData["message-success"] = "Příspěvek do diskuze byl úspěšně přidán"; } else { return(View("Create", comment)); } try { SendNotificationEmail(comment.AuthorEmail, articleTitle); } catch (Exception e) { TempData["error"] = e; } return(RedirectToAction("CommentsForArticle", new RouteValueDictionary( new { controller = "Comments", action = "CommentsForArticle", articleId = articleId }))); }
public static async Task <CommentService> Create() { var commentDao = await CommentDao.Create(); return(new CommentService(commentDao)); }