public ActionResult Add(string nick, string email, string body, int articleID) { Reply entity = new Reply(); entity.ArticleID = articleID; entity.Body = CodeNote.Common.StringFilter.ClearHtml(body); entity.Nick = nick; entity.Email = email; entity.CreateDate = DateTime.Now; if (CurUser != null) { entity.CreateID = CurUser.ID; } ReturnValue retValue = new ReturnValue(); retValue = this.ReplayMg.Add(entity); return Json(retValue); }
public ReturnValue Add(Reply entity) { ReturnValue retValue = new ReturnValue(); if (entity.ArticleID < 1) { retValue.IsExists = false; retValue.Message = "回复对象未知"; return retValue; } if (string.IsNullOrEmpty(entity.Nick)) { retValue.IsExists = false; retValue.Message = "请输入昵称"; return retValue; } if (string.IsNullOrEmpty(entity.Email)) { retValue.IsExists = false; retValue.Message = "请输入电子邮件地址"; return retValue; } if (string.IsNullOrEmpty(entity.Body)) { retValue.IsExists = false; retValue.Message = "请输入回复内容"; return retValue; } using (ReplyDal dal = new ReplyDal()) { if (dal.Add(entity)) { retValue.IsExists = true; retValue.Message = "回复成功"; } else { retValue.IsExists = false; retValue.Message = "回复失败"; } } return retValue; }