コード例 #1
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public async Task <string> UpdateAsync(SnLabels entity)
        {
            int da = await CreateService <SnLabels>().UpdateAsync(entity);

            string data = da == 1 ? "更新成功" : "更新失败";

            return(data);
        }
コード例 #2
0
        public async Task <SnLabels> GetByIdAsync(int id)
        {
            SnLabels labels = null;

            labels = _cacheUtil.CacheString("GetByIdAsync" + id, labels);
            if (labels == null)
            {
                labels = await _service.SnLabels.FindAsync(id);

                _cacheUtil.CacheString("GetByIdAsync" + id, labels);
            }
            return(labels);
        }
コード例 #3
0
        public async Task <SnLabels> GetByIdAsync(int id)
        {
            SnLabels labels = null;

            labels = _cacheUtil.CacheString("ReGetByIdAsync" + id, labels);
            if (labels == null)
            {
                labels = await CreateService <SnLabels>().GetByIdAsync(id);

                _cacheUtil.CacheString("ReGetByIdAsync" + id, labels);
            }
            return(labels);
        }
コード例 #4
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public async Task <bool> UpdateAsync(SnLabels entity)
 {
     _service.SnLabels.Update(entity);
     return(await _service.SaveChangesAsync() > 0);
 }
コード例 #5
0
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public async Task <bool> AddAsync(SnLabels entity)
        {
            await _service.SnLabels.AddAsync(entity);

            return(await _service.SaveChangesAsync() > 0);
        }
コード例 #6
0
 /// <summary>
 /// 添加数据
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public async Task <SnLabels> AddAsync(SnLabels entity)
 {
     return(await CreateService <SnLabels>().AddAsync(entity));
 }