コード例 #1
0
ファイル: BugController.cs プロジェクト: pear171902790/Bug
 public ActionResult AddComment(string content, long bugId)
 {
     var jsonResult = new JsonResult();
     try
     {
         var userId = _cookieHelper.GetUserId(Request);
         var user = _userLogic.Get(userId);
         var bugComment=new BugComment
             {
                 Commentator = user.UserName,
                 Content = content,
                 BugId = bugId,
                 AddTime = DateTime.Now
             };
         _bugCommentLogic.Add(bugComment);
         jsonResult.Data = new {Status = true};
     }
     catch (Exception)
     {
         jsonResult.Data = new { Status = false };
     }
     return jsonResult;
 }
コード例 #2
0
ファイル: BugCommentLogic.cs プロジェクト: pear171902790/Bug
 public void Add(BugComment bugComment)
 {
     _bugCommentRepository.Add(bugComment);
 }
コード例 #3
0
 public void Add(BugComment bugComment)
 {
     _bugTrackDbContext.BugComments.Add(bugComment);
     _bugTrackDbContext.SaveChanges();
 }