Ejemplo n.º 1
0
 public ActionResult AddComment(FormCollection form)
 {
     try
     {
         db.StudentInfo.Where(s => s.Id == studentId).FirstOrDefault();
         BlogReply br = new BlogReply
         {
             BlogId = Convert.ToInt32(form["BlogID"]),
             ReplyId = studentId,
             ReplyAccount = db.StudentInfo.Where(s => s.Id == studentId).FirstOrDefault().Account,
             ReplyContent = form["Content"],
             CreatTime = DateTime.Now.ToLongDateString() + DateTime.Now.ToShortTimeString()
         };
         mHelp.Add<BlogReply>(br);
         return RedirectToAction("BlogDetail", new { id = br.BlogId });
     }
     catch (Exception)
     {
         return RedirectToAction("BlogDetail", new { id = Convert.ToInt32(form["BlogID"]) });
     }
 }
Ejemplo n.º 2
0
        public ActionResult AddComment(FormCollection form)
        {
            Guid teacherId = new Guid(TakeCookie.GetCookie("userId"));
            try
            {
                db.TeacherInfo.Where(s => s.Id == teacherId).FirstOrDefault();
                BlogReply br = new BlogReply
                {
                    BlogId = Convert.ToInt32(form["BlogID"]),
                    ReplyId = teacherId,
                    ReplyAccount = db.TeacherInfo.Where(s => s.Id == teacherId).FirstOrDefault().Account,
                    ReplyContent = form["Content"],
                    CreatTime = DateTime.Now.ToLongDateString() + DateTime.Now.ToShortTimeString()
                };

                modelHelp.Add<BlogReply>(br);
                return RedirectToAction("TeacherGetBlogDetail", "LoadMore", new { id = br.BlogId });
            }
            catch (Exception)
            {
                return RedirectToAction("TeacherGetBlogDetail", "LoadMore", new { id = Convert.ToInt32(form["BlogID"]) });
            }
        }