示例#1
0
        /// <summary>
        /// 详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Info(int id)
        {
            E_CommentType model = new E_CommentType();

            model.commenttypeid = id;
            ViewBag.Info        = dal.GetInfoById(model);
            return(View());
        }
示例#2
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Save(E_CommentType model)
 {
     if (model != null && model.commenttypeid > 0)
     {
         return(dal.Update(model));
     }
     return(dal.Add(model));
 }
示例#3
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="model"></param>
        /// <returns></returns>
        public E_CommentType GetInfoById(E_CommentType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from dp_commenttype where commenttypeid=@commenttypeid");
            using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr()))
            {
                model = conn.Query <E_CommentType>(strSql.ToString(), model)?.FirstOrDefault();
            }
            return(model);
        }
示例#4
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Add(E_CommentType model)
        {
            string sql = "INSERT INTO dp_commenttype([typename]) VALUES (@typename)";

            using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr()))
            {
                int count = conn.Execute(sql, model);
                if (count > 0)//如果更新失败
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#5
0
        /// <summary>
        /// 查询某主题下的点评维度
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public List <E_CommentType> GetListByThemeid(E_CommentType model)
        {
            List <E_CommentType> list;
            StringBuilder        strSql = new StringBuilder();

            strSql.Append(@"select * from dp_commenttype  where commenttypeid in
                            (
                                select commenttypeid from (
                                select * from dp_themecommentitem where themeid=@themeid
                                ) as A inner join dp_commentitem as B on A.commentitemid=B.commentitemid
                                group by commenttypeid
                            ) and isdelete=0");
            using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr()))
            {
                list = conn.Query <E_CommentType>(strSql.ToString(), model)?.ToList();
            }
            return(list);
        }
示例#6
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool DeleteById(E_CommentType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dp_commenttype set isdelete=1  where commenttypeid=@commenttypeid ");
            using (IDbConnection conn = new SqlConnection(DapperHelper.GetConStr()))
            {
                int count = conn.Execute(strSql.ToString(), model);
                if (count > 0)//如果更新失败
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
示例#7
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Delete(E_CommentType model)
 {
     return(dal.DeleteById(model));
 }