public async Task <IActionResult> ChangeCollateralModel([FromRoute] long applicationNumber, [FromRoute] int arrangementRequestId, [FromBody] UpdateCollateralModelCommand command) { command.ApplicationNumber = applicationNumber; command.ArrangementRequestId = arrangementRequestId; var updateCollateralModel = new IdentifiedCommand <UpdateCollateralModelCommand, bool?>(command, new Guid()); var commandResult = await _mediator.Send(updateCollateralModel); if (commandResult.HasValue) { if (commandResult.Value) { var recalculateCommand = new RecalculateArrangementRequestCommand { ApplicationNumber = applicationNumber, ArrangementRequestId = arrangementRequestId }; var recalculateArrangementRequestCommand = new IdentifiedCommand <RecalculateArrangementRequestCommand, bool?>(recalculateCommand, new Guid()); commandResult = await _mediator.Send(recalculateArrangementRequestCommand); return(commandResult.HasValue && commandResult.Value ? (IActionResult)Ok() : (IActionResult)BadRequest()); } else { return(BadRequest()); } } else { return(NotFound()); } }
public async Task <IActionResult> RecalculateArrangementRequest([FromRoute] long applicationNumber, [FromRoute] int arrangementRequestId) { var command = new RecalculateArrangementRequestCommand { ApplicationNumber = applicationNumber, ArrangementRequestId = arrangementRequestId }; var recalculateArrangementRequestCommand = new IdentifiedCommand <RecalculateArrangementRequestCommand, bool?>(command, new Guid()); var commandResult = await _mediator.Send(recalculateArrangementRequestCommand); return(commandResult.HasValue ? commandResult.Value ? (IActionResult)Ok() : (IActionResult)BadRequest() : NotFound()); }