示例#1
0
        public async Task <DataflowDto> PartialUpdateDataflowAsync(Guid id, UpdateDataflowDto updateDataflowDto, CancellationToken ct)
        {
            var dataflowEntity = await _uow.Dataflows.GetAsync(id, ct);

            _mapper.Map(updateDataflowDto, dataflowEntity);

            await _uow.Dataflows.UpdateAsync(dataflowEntity, id, ct, dataflowEntity.RowVersion);

            await _uow.SaveChangesAsync(ct);

            dataflowEntity = await _uow.Dataflows.GetAsync(id, ct);

            var dataflowDto = _mapper.Map <DataflowDto>(dataflowEntity);

            return(dataflowDto);
        }
示例#2
0
        public async Task <ActionResult> UpdateDataflow([FromRoute] Guid id, [FromBody] UpdateDataflowDto updateDataflowDto, CancellationToken ct)
        {
            if (!await _dataflowService.ExistsAsync(id, ct))
            {
                return(NotFound());
            }

            var dataflowToReturn = await _dataflowService.UpdateDataflowAsync(id, updateDataflowDto, ct);

            if (dataflowToReturn == null)
            {
                return(BadRequest());
            }

            return(Ok(dataflowToReturn));
        }
示例#3
0
        public async Task <DataflowDto> UpdateDataflowAsync(Guid id, UpdateDataflowDto updateDataflowDto, CancellationToken ct)
        {
            DataflowDto dataflowDto = null;

            var updatedEntity = _mapper.Map <Dataflow>(updateDataflowDto);

            updatedEntity.Id = id;
            await _uow.Dataflows.UpdateAsync(updatedEntity, id, ct, updatedEntity.RowVersion);

            await _uow.SaveChangesAsync(ct);

            var dataflowEntity = await _uow.Dataflows.GetAsync(id, ct);

            dataflowDto = _mapper.Map <DataflowDto>(dataflowEntity);

            return(dataflowDto);
        }