Пример #1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="model"></param>
        /// <returns></returns>
        public List <dp_themeopinion> GetList(dp_themeopinion model)
        {
            List <dp_themeopinion> list;
            StringBuilder          strSql = new StringBuilder();

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

            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_themeopinion model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete dp_themeopinion    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);
                }
            }
        }