public ActionResult Add(string name, string remark, int songid) { Comment newComment = new Comment(); newComment.Name = name; newComment.Remark = remark; newComment.SongID = songid; repository.AddComment(newComment); return Redirect(Request.UrlReferrer.ToString() + "#Comment-" + songid); }
public void AddComment(Comment comment) { context.Comments.Add(comment); context.SaveChanges(); }