Exemple #1
0
 //添加评论
 public ActionResult AddComment(int id, string content, int score)
 {
     if (Request.Cookies["Login"] == null)
     {
         return(Content("login"));
     }
     else
     {
         HttpCookie   cookie = Request.Cookies["Login"];
         JObject      name   = readtoken(cookie.Values["Token"]);
         ShortComment sc     = new ShortComment
         {
             UserName    = name["UserName"].ToString(),
             Animationid = id,
             Time        = DateTime.Now,
             content     = content,
             Likenum     = 0,
             Score       = score
         };
         bool add = aManager.AddComment(sc);
         if (add)
         {
             var comm = aManager.GetShortComments(id, 1);
             return(PartialView("ShortComment", comm));
         }
         else
         {
             return(Content("fail"));
         }
     }
 }
Exemple #2
0
 public bool AddComment(ShortComment sc)
 {
     db.ShortComment.Add(sc);
     if (db.SaveChanges() > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #3
0
 public void QueryForComments(string issueId)
 {
     Task.Factory.StartNew(() => Proxy.QueryComments(issueId)).ContinueWith(
         r =>
     {
         Application.Current.Dispatcher.Invoke(new Action(() => Comments.Clear()));
         foreach (var comment in r.Result)
         {
             ShortComment comment1 = comment;
             Application.Current.Dispatcher.Invoke(new Action(() => Comments.Add(comment1)));
         }
     });
 }
 /// <summary>
 /// 添加动漫短评
 /// </summary>
 /// <param name="sc"></param>
 /// <returns></returns>
 public bool AddComment(ShortComment sc)
 {
     return(animation.AddComment(sc));
 }