public async Task UpdateKundeTest() { var kunde = await _target.GetKundeById(1); kunde.Vorname = "Elfriede"; await _target.UpdateKunde(kunde); var result = await _target.GetKundeById(1); Assert.Equal("Elfriede", result.Vorname); }
public override async Task <KundeDto> UpdateKunde(KundeDto request, ServerCallContext context) { try { var kunde = request.ConvertToEntity(); var response = await kundeManager.UpdateKunde(kunde); return(response.ConvertToDto()); } catch (OptimisticConcurrencyException <Kunde> e) { throw new RpcException(new Status(StatusCode.Aborted, e.Message), e.MergedEntity.ToString()); } }
public KundeDto UpdateKunde(KundeDto kunde) { WriteActualMethod(); try { return(DtoConverter.ConvertToDto(kundeManager.UpdateKunde(DtoConverter.ConvertToEntity(kunde)))); } catch (OptimisticConcurrencyException <Kunde> ) { OptimisticConcurrencyFault <KundeDto> fault = new OptimisticConcurrencyFault <KundeDto> { FaultEntity = kunde, CurrentEntity = DtoConverter.ConvertToDto(kundeManager.ReadKunde(kunde.Id)) }; throw new FaultException <OptimisticConcurrencyFault <KundeDto> >(fault); } }
public void updateKunde(KundeDto kunde) { WriteActualMethod(); try { _kundenManager.UpdateKunde(kunde.ConvertToEntity()); } catch (InvalidOperationException) { OutOfRangeFault fault = new OutOfRangeFault { Operation = "update" }; throw new FaultException <OutOfRangeFault>(fault); } catch (DbUpdateConcurrencyException) { ConcurrencyFault fault = new ConcurrencyFault(); throw new FaultException <ConcurrencyFault>(fault); } }