public override ActionResult UpdateSubmit(FormCollection fm) { XCLNetTools.Message.MessageModel msgModel = new XCLNetTools.Message.MessageModel(); var viewModel = this.GetViewModel(fm); var model = new XCLCMS.Data.Model.Comments(); model.CommentsID = viewModel.Comments.CommentsID; model.RecordState = viewModel.Comments.RecordState; model.FK_MerchantAppID = viewModel.Comments.FK_MerchantAppID; model.FK_MerchantID = viewModel.Comments.FK_MerchantID; model.BadCount = viewModel.Comments.BadCount; model.Contents = viewModel.Comments.Contents; model.Email = viewModel.Comments.Email; model.FK_ObjectID = viewModel.Comments.FK_ObjectID; model.GoodCount = viewModel.Comments.GoodCount; model.MiddleCount = viewModel.Comments.MiddleCount; model.ObjectType = viewModel.Comments.ObjectType; model.ParentCommentID = viewModel.Comments.ParentCommentID; model.Remark = viewModel.Comments.Remark; model.UserName = viewModel.Comments.UserName; model.VerifyState = viewModel.Comments.VerifyState; var request = XCLCMS.Lib.WebAPI.Library.CreateRequest <XCLCMS.Data.Model.Comments>(base.UserToken); request.Body = new Data.Model.Comments(); request.Body = model; var response = XCLCMS.Lib.WebAPI.CommentsAPI.Update(request); return(Json(response)); }
public override ActionResult AddSubmit(FormCollection fm) { XCLNetTools.Message.MessageModel msgModel = new XCLNetTools.Message.MessageModel(); var viewModel = this.GetViewModel(fm); var model = new XCLCMS.Data.Model.Comments(); model.CommentsID = XCLCMS.Lib.WebAPI.Library.CommonAPI_GenerateID(base.UserToken, new Data.WebAPIEntity.RequestEntity.Common.GenerateIDEntity() { IDType = Data.CommonHelper.EnumType.IDTypeEnum.CMT.ToString() }); model.RecordState = viewModel.Comments.RecordState; model.FK_MerchantAppID = viewModel.Comments.FK_MerchantAppID; model.FK_MerchantID = viewModel.Comments.FK_MerchantID; model.BadCount = viewModel.Comments.BadCount; model.Contents = viewModel.Comments.Contents; model.Email = viewModel.Comments.Email; model.FK_ObjectID = viewModel.Comments.FK_ObjectID; model.GoodCount = viewModel.Comments.GoodCount; model.MiddleCount = viewModel.Comments.MiddleCount; model.ObjectType = viewModel.Comments.ObjectType; model.ParentCommentID = viewModel.Comments.ParentCommentID; model.Remark = viewModel.Comments.Remark; model.UserName = viewModel.Comments.UserName; model.VerifyState = viewModel.Comments.VerifyState; var request = XCLCMS.Lib.WebAPI.Library.CreateRequest <XCLCMS.Data.Model.Comments>(base.UserToken); request.Body = new Data.Model.Comments(); request.Body = model; var response = XCLCMS.Lib.WebAPI.CommentsAPI.Add(request); return(Json(response)); }
/// <summary> /// 得到一个对象实体 /// </summary> public XCLCMS.Data.Model.Comments GetModel(long CommentsID) { XCLCMS.Data.Model.Comments model = new XCLCMS.Data.Model.Comments(); Database db = base.CreateDatabase(); DbCommand dbCommand = db.GetSqlStringCommand("select * from Comments WITH(NOLOCK) where CommentsID=@CommentsID"); db.AddInParameter(dbCommand, "CommentsID", DbType.Int64, CommentsID); using (var dr = db.ExecuteReader(dbCommand)) { return(XCLNetTools.DataSource.DataReaderHelper.DataReaderToEntity <XCLCMS.Data.Model.Comments>(dr)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(XCLCMS.Data.Model.Comments model) { Database db = base.CreateDatabase(); DbCommand dbCommand = db.GetStoredProcCommand("sp_Comments_Update"); db.AddInParameter(dbCommand, "CommentsID", DbType.Int64, model.CommentsID); db.AddInParameter(dbCommand, "ObjectType", DbType.AnsiString, model.ObjectType); db.AddInParameter(dbCommand, "FK_ObjectID", DbType.Int64, model.FK_ObjectID); db.AddInParameter(dbCommand, "UserName", DbType.String, model.UserName); db.AddInParameter(dbCommand, "Email", DbType.AnsiString, model.Email); db.AddInParameter(dbCommand, "ParentCommentID", DbType.Int64, model.ParentCommentID); db.AddInParameter(dbCommand, "GoodCount", DbType.Int32, model.GoodCount); db.AddInParameter(dbCommand, "MiddleCount", DbType.Int32, model.MiddleCount); db.AddInParameter(dbCommand, "BadCount", DbType.Int32, model.BadCount); db.AddInParameter(dbCommand, "Contents", DbType.String, model.Contents); db.AddInParameter(dbCommand, "VerifyState", DbType.AnsiString, model.VerifyState); db.AddInParameter(dbCommand, "Remark", DbType.String, model.Remark); db.AddInParameter(dbCommand, "FK_MerchantID", DbType.Int64, model.FK_MerchantID); db.AddInParameter(dbCommand, "FK_MerchantAppID", DbType.Int64, model.FK_MerchantAppID); db.AddInParameter(dbCommand, "RecordState", DbType.AnsiString, model.RecordState); db.AddInParameter(dbCommand, "CreateTime", DbType.DateTime, model.CreateTime); db.AddInParameter(dbCommand, "CreaterID", DbType.Int64, model.CreaterID); db.AddInParameter(dbCommand, "CreaterName", DbType.String, model.CreaterName); db.AddInParameter(dbCommand, "UpdateTime", DbType.DateTime, model.UpdateTime); db.AddInParameter(dbCommand, "UpdaterID", DbType.Int64, model.UpdaterID); db.AddInParameter(dbCommand, "UpdaterName", DbType.String, model.UpdaterName); db.AddOutParameter(dbCommand, "ResultCode", DbType.Int32, 4); db.AddOutParameter(dbCommand, "ResultMessage", DbType.String, 1000); db.ExecuteNonQuery(dbCommand); var result = XCLCMS.Data.DAL.Common.Common.GetProcedureResult(dbCommand.Parameters); if (result.IsSuccess) { return(true); } else { throw new Exception(result.ResultMessage); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(XCLCMS.Data.Model.Comments model) { return dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(XCLCMS.Data.Model.Comments model) { return dal.Add(model); }