コード例 #1
0
ファイル: CarDataAccess.cs プロジェクト: Chinaccn/surfboard
 /// <summary>
 /// 检查重复收藏
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public CarCollectionModel CheckCollection(CarCollectionModel model)
 {
     const string sql =
         @"select innerid, custid, carid, remark, createdtime from car_collection where custid=@custid and carid=@carid;";
     return
         Helper.Query<CarCollectionModel>(sql, new { custid = model.Custid, carid = model.Carid }).FirstOrDefault();
 }
コード例 #2
0
ファイル: CarDataAccess.cs プロジェクト: Chinaccn/surfboard
        /// <summary>
        /// 添加收藏
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddCollection(CarCollectionModel model)
        {
            const string sql = @"INSERT INTO car_collection
                        (innerid, custid, carid, remark, createdtime)
                        VALUES
                        (@innerid, @custid, @carid, @remark, @createdtime);";

            try
            {
                Helper.Execute(sql, model);
                return 1;
            }
            catch (Exception ex)
            {
                LoggerFactories.CreateLogger().Write("添加收藏异常:", TraceEventType.Error, ex);
                return 0;
            }
        }