/// <summary>
 /// 向数据库中添加一条记录
 /// </summary>
 /// <param name="model">要添加的实体</param>
 /// <returns>插入数据的ID</returns>
 public int Insert(PictureCollectModel model)
 {
     #region SQL语句
     const string sql = @"
     INSERT INTO [dbo].[PictureCollect] (
     [PId]
     ,[CuId]
     ,[CollectDate]
     )
     VALUES (
     @PId
     ,@CuId
     ,@CollectDate
     );select @@IDENTITY";
     #endregion
     var res = SqlHelper.ExecuteScalar(sql,
             new SqlParameter("@PId", model.PId),
             new SqlParameter("@CuId", model.CuId),
             new SqlParameter("@CollectDate", model.CollectDate)
         );
     return res == null ? 0 : Convert.ToInt32(res);
 }
 /// <summary>
 /// 根据主键ID更新一条记录
 /// </summary>
 /// <param name="model">更新后的实体</param>
 /// <returns>执行结果受影响行数</returns>
 public int Update(PictureCollectModel model)
 {
     return _dao.Update(model);
 }
 /// <summary>
 /// 向数据库中添加一条记录
 /// </summary>
 /// <param name="model">要添加的实体</param>
 /// <returns>插入数据的ID</returns>
 public int Insert(PictureCollectModel model)
 {
     return _dao.Insert(model);
 }
 /// <summary>
 /// 根据主键ID更新一条记录
 /// </summary>
 /// <param name="model">更新后的实体</param>
 /// <returns>执行结果受影响行数</returns>
 public int Update(PictureCollectModel model)
 {
     #region SQL语句
     const string sql = @"
     UPDATE [dbo].[PictureCollect]
     SET
     [PId] = @PId
     ,[CuId] = @CuId
     ,[CollectDate] = @CollectDate
     WHERE [CId] = @CId";
     #endregion
     return SqlHelper.ExecuteNonQuery(sql,
             new SqlParameter("@CId", model.CId),
             new SqlParameter("@PId", model.PId),
             new SqlParameter("@CuId", model.CuId),
             new SqlParameter("@CollectDate", model.CollectDate)
         );
 }