Exemplo n.º 1
0
        public override async Task <CancelCarBookingReply> CancelBooking(CancelCarBookingRequest request,
                                                                         ServerCallContext context)
        {
            try
            {
                var car = await _queryRepository.GetCarByBookingId(request.CarBookingId);

                car.Cancel(request.CarBookingId);
                await _repository.UpdateAsync(car);

                return(new CancelCarBookingReply()
                {
                    IsSuccess = true
                });
            }
            catch (DomainException e)
            {
                return(new CancelCarBookingReply()
                {
                    IsSuccess = false,
                    Reason = e.Message
                });
            }
        }