Beispiel #1
0
        public void Update(HotSearchKeyInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"UPDATE [HotSearchKey] SET Name = @Name, SearchTimes = @SearchTimes, AddCol1 = @AddCol1, AddCol2 = @AddCol2 where Id=@Id";

                conn.Execute(sql, entity);
            }
        }
Beispiel #2
0
        public int Add(HotSearchKeyInfo entity)
        {
            using (var conn = new SqlConnection(connectString))
            {
                string sql = @"INSERT INTO [HotSearchKey](Name,[SearchTimes],[AddCol1],[AddCol2]) VALUES(@Name,@SearchTimes,@AddCol1,@AddCol2);
                            select SCOPE_IDENTITY()";

                return(conn.Query <int>(sql, entity).Single());
            }
        }
 public static void Update(HotSearchKeyInfo entity)
 {
     dal.Update(entity);
     CacheHelper.Remove(cacheKey);
 }
 public static int Add(HotSearchKeyInfo entity)
 {
     entity.Id = dal.Add(entity);
     CacheHelper.Remove(cacheKey);
     return(entity.Id);
 }