Example #1
0
        public async Task UpdateAutoTest()
        {
            var auto = await _target.GetById(2);

            auto.Tagestarif = 100;
            await _target.Update(auto);

            var result = await _target.GetById(2);

            Assert.Equal(100, result.Tagestarif);
        }
        public AutoDto ReadAuto(int id)
        {
            WriteActualMethod();

            var car = _autoManager.GetById(id);

            if (car == null)
            {
                throw new FaultException <AutoReservationFault>(new AutoReservationFault
                {
                    ErrorCode = AutoReservationFault.RequestedEntityDoesNotExist
                });
            }

            return(car.ConvertToDto());
        }
Example #3
0
        public override async Task <AutoDto> GetById(GetAutoByIdRequest request, ServerCallContext context)
        {
            AutoManager manager = new AutoManager();
            Auto        auto    = await manager.GetById(request.Id);

            AutoDto result = auto.ConvertToDto();

            return(result);
        }
 public AutoDto GetAutoById(int id)
 {
     try
     {
         return(AutoManager.GetById(id).ConvertToDto());
     }
     catch (InvalidOperationException)
     {
         var fault = new GenericFault("Keine Gültige ID");
         throw new FaultException <GenericFault>(fault);
     }
 }
 public AutoDto GetAutoById(int autoId)
 {
     WriteActualMethod();
     return(autoManager.GetById(autoId).ConvertToDto());
 }