示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,User_publish,User_accept,Create_time,content,blog_id,comment_id")] mb_comment mb_comment)
        {
            if (id != mb_comment.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mb_comment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!mb_commentExists(mb_comment.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(mb_comment));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("ID,User_publish,User_accept,Create_time,content,blog_id,comment_id")] mb_comment mb_comment, string bid, string createid)
        {
            if (ModelState.IsValid)
            {
                mb_comment.User_publish = User.Identity.Name;
                mb_comment.Create_time  = DateTime.Now;

                _context.Add(mb_comment);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details", "Blog", new { id = bid, createid = createid }));
            }
            return(View(mb_comment));
        }
 public CommentDetails(mb_comment comment, mb_user user)
 {
     this.user    = user;
     this.listson = new List <CommentDetails>();
     this.comment = comment;
 }