public UpdateClaimFlightApiRequest(UpdateClaimFlightApiModel updateClaimFlightApiModel)
        {
            Ensure.That(updateClaimFlightApiModel, nameof(updateClaimFlightApiModel)).IsNotNull();

            this.UpdateClaimFlightApiModel = updateClaimFlightApiModel;
        }
Esempio n. 2
0
        public async Task <ActionResult <UpdateClaimFlightApiResponseModel> > UpdateClaimFlight(int claimId, [FromBody] UpdateClaimFlightApiModel updateClaimFlightApiModel)
        {
            var existingClaim = await this.mediator.Send(new GetClaimFlightByClaimIdApiRequest(updateClaimFlightApiModel.ClaimId));

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

            var updateClaimApiRequest = new UpdateClaimFlightApiRequest(updateClaimFlightApiModel);

            var response = await this.mediator.Send(updateClaimApiRequest);

            if (response == null)
            {
                throw new InvalidOperationException($"Updating claimId {updateClaimFlightApiModel.ClaimId} failed.");
            }

            return(this.Ok(response));
        }