Example #1
0
 /// <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();
 }
Example #2
0
        /// <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;
            }
        }