Example #1
0
        /// <summary>
        /// 修改操作
        /// </summary>
        /// <param name="sql"></param>
        /// <returns></returns>
        public static async Task <bool> UpdateAsync <T>(this T model, string id) where T : BaseModel
        {
            string sql = SplicingSql <T> .UpdataSql(id);

            var parp = SplicingSql <T> .ParameterArray(model);

            return(await AdoDataBasics.ExecuteNonqueryAsync(sql, CommandType.Text, parp));
        }
Example #2
0
        /// <summary>
        /// 查询操作
        /// </summary>
        public static async Task <List <T> > GetListAsync <T>(this T model, string id) where T : BaseModel
        {
            string sql = SplicingSql <T> .SelectSql(id);

            var da = await AdoDataBasics.GetDataTableAsync(sql, CommandType.Text);

            List <T> list = new List <T> {
            };

            if (da.Rows.Count > 0)
            {
                foreach (DataRow row in da.Rows)
                {
                    list.Add(LoadEntity <T>(model, row) as T);
                }
            }
            return(list);
        }