public void InsertKundeTest()
        {
            Kunde kunde = new Kunde();

            kunde.Vorname      = "Michael";
            kunde.Nachname     = "Mann";
            kunde.Geburtsdatum = new DateTime(1992, 3, 14);
            Target.InsertKunde(kunde.ConvertToDto());
            Assert.AreEqual(kunde.ConvertToDto().Geburtsdatum, Target.GetKundeById(5).Geburtsdatum);
        }
Exemplo n.º 2
0
        public KundeDto GetKundeById(int id)
        {
            WriteActualMethod();
            Kunde k = BusinessComponent.GetKundeById(id);

            return(k.ConvertToDto());
        }
Exemplo n.º 3
0
        public KundeDto InsertKunde(KundeDto kundeDto)
        {
            Kunde kunde = kundeDto.ConvertToEntity();

            autoReservationBusinessComponent.InsertKunde(kunde);
            return(kunde.ConvertToDto());
        }
Exemplo n.º 4
0
        public override async Task <KundeDto> Insert(KundeDto request, ServerCallContext context)
        {
            KundeManager manager  = new KundeManager();
            Kunde        kunde    = request.ConvertToEntity();
            Kunde        newKunde = await manager.Insert(kunde);

            return(newKunde.ConvertToDto());
        }
Exemplo n.º 5
0
        public override async Task <KundeDto> GetById(GetKundeByIdRequest request, ServerCallContext context)
        {
            KundeManager manager = new KundeManager();
            Kunde        kunde   = await manager.GetById(request.Id);

            KundeDto result = kunde.ConvertToDto();

            return(result);
        }
Exemplo n.º 6
0
        public override async Task <KundeDto> Get(KundeRequest request, ServerCallContext context)
        {
            KundeManager manager  = new KundeManager();
            Kunde        customer = await manager.Get(request.Id);

            if (customer == null)
            {
                throw new RpcException(new Status(
                                           StatusCode.OutOfRange, "Id couldn't be found."
                                           ));
            }
            return(customer.ConvertToDto());
        }
Exemplo n.º 7
0
        public override async Task <KundeDto> Get(KundeRequest request, ServerCallContext context)
        {
            Kunde result = await ClientManager.Get(request.Id);

            if (result == null)
            {
                throw new RpcException(new Status(
                                           StatusCode.OutOfRange,
                                           "Client not found"
                                           ));
            }
            return(result.ConvertToDto());
        }
Exemplo n.º 8
0
        public override async Task <KundeDto> Update(KundeDto request, ServerCallContext context)
        {
            try
            {
                KundeManager manager = new KundeManager();
                Kunde        kunde   = await manager.Update(request.ConvertToEntity());

                KundeDto result = kunde.ConvertToDto();
                return(result);
            }
            catch (OptimisticConcurrencyException <Auto> e)
            {
                throw new RpcException(new Status(StatusCode.Aborted, e.Message));
            }
        }
Exemplo n.º 9
0
 public KundeDto UpdateKunde(KundeDto kundeDto)
 {
     try {
         Kunde kunde = kundeDto.ConvertToEntity();
         autoReservationBusinessComponent.UpdateKunde(kunde);
         return(kunde.ConvertToDto());
     } catch (LocalOptimisticConcurrencyException <Kunde> ex)
     {
         OptimisticConcurrencyFaultContract ocfc = new OptimisticConcurrencyFaultContract
         {
             Operation = "UpdateKunde",
             Message   = ex.Message
         };
         throw new FaultException <OptimisticConcurrencyFaultContract>(ocfc);
     }
 }
        public void AddKunde(KundeDto kunde)
        {
            WriteActualMethod();
            IAutoReservationResultCallback cb = _createCallbackChannel();

            try
            {
                Kunde insertedKunde = kundeManager.Insert(kunde.ConvertToEntity());
                cb.SendKunde(insertedKunde.ConvertToDto());
            }
            catch (DatabaseChangeException ex)
            {
                cb.SendFault(new CommunicationFault {
                    Exception = ex.Message
                });
            }
        }
Exemplo n.º 11
0
        public override async Task <KundeDto> Insert(KundeDto request, ServerCallContext context)
        {
            Kunde result = await ClientManager.Insert(request.ConvertToEntity());

            return(result.ConvertToDto());
        }