コード例 #1
0
 /// <summary>
 /// 修改数据
 /// </summary>
 /// <param name="model">实体</param>
 /// <returns>影响行数</returns>
 public int Update(FnStockAccount model)
 {
     return(DBContext.Update(StrTableName, model)
            .AutoMap(x => x.SysNo)
            .Where(x => x.SysNo)
            .Execute());
 }
コード例 #2
0
        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns>影响行数</returns>
        public JResult Update(FnStockAccount model)
        {
            var result = new JResult();

            try
            {
                var row = Using <IFnStockAccount>().Update(model);

                if (row <= 0)
                {
                    throw new Exception("修改数据失败");
                }

                result.Status = true;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return(result);
        }
コード例 #3
0
        /// <summary>
        /// 新增数据
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns>系统编号</returns>
        public JResult <int> Insert(FnStockAccount model)
        {
            var result = new JResult <int>();

            try
            {
                model.CreatedDate = DateTime.Now;
                var row = Using <IFnStockAccount>().Insert(model);

                if (row <= 0)
                {
                    throw new Exception("添加数据失败");
                }

                result.Status = true;
                result.Data   = row;
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }

            return(result);
        }
コード例 #4
0
 /// <summary>
 /// 新增数据
 /// </summary>
 /// <param name="model">实体</param>
 /// <returns>系统编号</returns>
 public int Insert(FnStockAccount model)
 {
     return(DBContext.Insert(StrTableName, model)
            .AutoMap(x => x.SysNo)
            .ExecuteReturnLastId <int>("SysNo"));
 }