/// <summary> /// 保存收藏 /// </summary> /// <param name="m"></param> /// <returns>新插入ID</returns> public int save(Models.learnCollect m) { string sql = "if not exists(select id from learnCollect where lid=@lid and [sid]=@sid and stype=@stype and kid=@kid) begin insert into learnCollect(lid,[sid],stype,kid)values(@lid,@sid,@stype,@kid)select @@IDENTITY end"; SqlParameter[] pars = { new SqlParameter("@lid", m.lid), new SqlParameter("@sid", m.sid), new SqlParameter("@stype", m.stype), new SqlParameter("@kid", m.kid) }; return(SqlHelper.ExcuteScalre(sql, pars)); }
/// <summary> /// 保存收藏 /// </summary> /// <param name="m"></param> /// <returns>新插入ID</returns> public static int save(Models.learnCollect m) { using (DAL.learn.learnCollectDAL dal = new DAL.learn.learnCollectDAL()) { if (m.cid > 0) { return(dal.delete(m.cid)); } else { return(dal.save(m)); } } }
// // GET: /learnpublic /// <summary> /// 保存收藏 /learnpublic/savecollect /// </summary> /// <param name="m"></param> /// <returns></returns> public int saveCollect(Models.learnCollect m) { return(BLL.learn.learnCollectBLL.save(m)); }