public bool SaveComment(NoteCommentInfo commnetInfo) { try { noteCommentRepository.Insert(commnetInfo); var note = learnNoteRepository.Get(commnetInfo.LearnNoteId); note.CommentCount += 1; learnNoteRepository.Update(note); return(true); } catch (Exception e) { return(false); } }
public ActionResult <dynamic> SaveComment(NoteCommentInfo info) { try { if (info != null) { info.Id = Guid.NewGuid().ToString(); info.SubmitTime = DateTime.Now; info.CommentatorId = "0000"; info.CommentatorName = "游客"; return(Ok(_noteCommentService.SaveComment(info))); } else { return(Error("参数错误")); } } catch (Exception e) { return(Error(e.Message)); } }