Example #1
0
        public async Task <IResponseEntity> UpdateAsync(ResourceEditRequest req)
        {
            if (req == null || req?.Id == "")
            {
                return(ResponseEntity.Error("更新的实体主键丢失"));
            }

            //var entity = await _sysResourceRepository.GetAsync(req.Id);
            //if (entity == null || entity?.Id == "")
            //{
            //    return ResponseEntity.Error("找不到更新的实体!");
            //}
            //_mapper.Map(req, entity);

            var entity = _mapper.Map <SysResourceEntity>(req);
            await _sysResourceRepository.UpdateAsync(entity);

            //清除缓存
            await _cache.RemoveByPatternAsync(CacheKeyTemplate.PermissionResourceList);

            return(ResponseEntity.Ok("更新成功"));
        }
 public async Task <IResponseEntity> Update(ResourceEditRequest req)
 {
     return(await _sysResourceService.UpdateAsync(req));
 }