예제 #1
0
        public async Task <ApiRequestResult> AddAsync(RoleDto dto)
        {
            var command = dto.EntityMap <RoleDto, Role>();
            await _roleRepository.AddAsync(command);

            return(ApiRequestResult.Success("添加成功"));
        }
예제 #2
0
        public async Task <ApiRequestResult> UpdateAsync(RoleDto dto)
        {
            var entity = await _roleRepository.GetAsync(dto.Id.Value);

            var newEntity = dto.EntityMap(entity);
            await _roleRepository.UpdateAsync(newEntity);

            return(ApiRequestResult.Success("修改成功"));
        }