public ActionResult CommentDetail(int CaseID = 0) { WebBuidingCaseComment comm = new WebBuidingCaseComment(); comm = commerSer.GetCommentByTypeAndID("WebBuiding", CaseID); if (comm == null) { comm = new WebBuidingCaseComment(); } return(View(comm)); }
public int AddWebBuidingCaseComment(WebBuidingCaseComment comment) { using (AIYunNetContext context = new AIYunNetContext()) { context.WebBuidingCaseComment.Add(comment); WebBuiding buiding = context.WebBuiding.FirstOrDefault(c => c.Guid == comment.Guid); buiding.IsComment = 1; context.SaveChanges(); return(1); } }
public JsonResult AddOrEditComment(WebBuidingCaseComment comm) { int ret = 0; if (comm.id == 0) { ret = commerSer.AddWebBuidingCaseComment(comm); } else { ret = commerSer.updateWebBuidingCaseComment(comm); } return(Json(new { RetCode = ret })); }
public WebBuidingCaseComment GetCommentByTypeAndID(string type, int id) { WebBuidingCaseComment comm = new WebBuidingCaseComment(); using (AIYunNetContext context = new AIYunNetContext()) { comm = context.WebBuidingCaseComment.FirstOrDefault(c => c.CaseID == id && c.CaseType == type); if (comm == null) { comm = new WebBuidingCaseComment(); } return(comm); } }
public int updateWebBuidingCaseComment(WebBuidingCaseComment comment) { WebBuidingCaseComment old = new WebBuidingCaseComment(); using (AIYunNetContext context = new AIYunNetContext()) { old = context.WebBuidingCaseComment.Find(comment.id); old.Score = comment.Score; old.Comment = comment.Comment; old.EditOn = DateTime.Now.ToString(); old.IsEdit = 1; WebBuiding buiding = context.WebBuiding.FirstOrDefault(c => c.Guid == comment.Guid); buiding.IsComment = 2; context.SaveChanges(); return(1); } }
public WebBuidingCaseComment GetWebBuidingCaseCommentByGuid(string guid) { WebBuidingCaseComment com = new WebBuidingCaseComment(); using (AIYunNetContext context = new AIYunNetContext()) { com = context.WebBuidingCaseComment.FirstOrDefault(c => c.Guid == guid); if (com != null) { return(com); } else { return(new WebBuidingCaseComment()); } } }