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

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

            var entity = _mapper.Map <SysGroupEntity>(req);
            await _sysGroupRepository.UpdateAsync(entity);

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

            return(ResponseEntity.Ok("更新成功"));
        }
 public async Task <IResponseEntity> Update(GroupEditRequest req)
 {
     return(await _sysGroupService.UpdateAsync(req));
 }
Пример #3
0
        public IActionResult Edit(GroupEditRequest command)
        {
            _groupService.Edit(command.GroupId, command.Name, command.Description);

            return(NoContent());
        }