示例#1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="model"></param>
        /// <returns></returns>
        public List <dp_themecommentitem> GetList(dp_themecommentitem model)
        {
            List <dp_themecommentitem> list;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from dp_themecommentitem where themeid=@themeid");
            using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr()))
            {
                list = conn.Query <dp_themecommentitem>(strSql.ToString(), model)?.ToList();
            }
            return(list);
        }
示例#2
0
        public bool Add(dp_themecommentitem model)
        {
            string sql = "INSERT INTO dp_themecommentitem(themeid,commentitemid) VALUES (@themeid,@commentitemid)";

            using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr()))
            {
                int count = conn.Execute(sql, model);
                if (count > 0)//如果更新失败
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#3
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool DeleteById(dp_themecommentitem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete dp_themecommentitem    where themeid=@themeid ");
            using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr()))
            {
                int count = conn.Execute(strSql.ToString(), model);
                if (count > 0)//如果更新失败
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }