public IActionResult Cancel(Guid id, AmendDirectDebitVm amendDirectDebitVmPostedBack) { // Restore VM from state field, so that we get lists and all other fields required to build view var amendDirectDebitVm = DeserialiseModel <AmendDirectDebitVm>(amendDirectDebitVmPostedBack.InitialState); Debug.Assert(amendDirectDebitVm.InitialState == null, "Serialisation Loop Detected - InitialState should be marked as JsonIgnore"); // Carry state through amendDirectDebitVm.InitialState = amendDirectDebitVmPostedBack.InitialState; // Place form field selections into restored VM _buildAmendDirectDebitVmService.UpdateFieldsFromUserEntries(amendDirectDebitVm, amendDirectDebitVmPostedBack); // Construct model for Cancel view var cancelVm = new ReturnToFormVm { State = SerialiseModel(amendDirectDebitVm), StateFieldName = nameof(AmendDirectDebitStateVm.FilledInState), StateType = nameof(AmendDirectDebitVm), ReturnControllerName = ControllerName, ReturnActionName = nameof(Change) }; return(View("PaymentCancel", cancelVm)); }
// Generates cancel view required when click 'Cancel' on Direct Debit bank details page public IActionResult DirectDebitCancel(Guid id, DirectDebitDetailsVm directDebitDetailsVmPostedBack) { // Restore fields not included in form (see Cancel for explanation) var directDebitDetailsVm = DeserialiseModel <DirectDebitDetailsVm>(directDebitDetailsVmPostedBack.InitialState); Debug.Assert(directDebitDetailsVm.InitialState == null, "Serialisation Loop Detected - a previous step must have serialised a model that already contains InitialState"); // Carry state through directDebitDetailsVm.InitialState = directDebitDetailsVmPostedBack.InitialState; directDebitDetailsVm.PaymentOptionsFilledInState = directDebitDetailsVmPostedBack.PaymentOptionsFilledInState; // Place form field selections into restored VM _buildDirectDebitDetailsVmService.UpdateFieldsFromUserEntries(directDebitDetailsVm, directDebitDetailsVmPostedBack); // Construct model for Cancel view var cancelVm = new ReturnToFormVm { State = SerialiseModel(directDebitDetailsVm), StateFieldName = nameof(DirectDebitDetailsStateVm.FilledInState), StateType = nameof(DirectDebitDetailsVm), ReturnControllerName = ControllerName, ReturnActionName = nameof(DirectDebitChange) }; return(View("PaymentCancel", cancelVm)); }
public IActionResult PaymentMethods(Guid id, PaymentOptionsVm paymentOptionsVmPostedBack) { // Restore VM from state field, so that we get lists and all other fields required to build view var paymentOptionsVm = DeserialiseModel <PaymentOptionsVm>(paymentOptionsVmPostedBack.InitialState); Debug.Assert(paymentOptionsVm.InitialState == null, "Serialisation Loop Detected - InitialState should be marked as JsonIgnore"); // Carry state through paymentOptionsVm.InitialState = paymentOptionsVmPostedBack.InitialState; // Place form field selections into restored VM _buildPaymentOptionsVmService.UpdateFieldsFromUserEntries( LoggedInUser, paymentOptionsVm, paymentOptionsVmPostedBack); // Construct model for Cancel view var returnToFormVm = new ReturnToFormVm { State = SerialiseModel(paymentOptionsVm), StateFieldName = nameof(PaymentOptionsStateVm.FilledInState), StateType = nameof(PaymentOptionsVm), ReturnControllerName = ControllerName, ReturnActionName = nameof(Change) }; return(View("PaymentMethods", returnToFormVm)); }
public IActionResult ConfirmCancel(Guid id, AmendDirectDebitStateVm amendDirectDebitStateVm) { // Construct model for Cancel view var cancelVm = new ReturnToFormVm { State = amendDirectDebitStateVm.FilledInState, StateFieldName = nameof(AmendDirectDebitStateVm.FilledInState), StateType = nameof(AmendDirectDebitVm), ReturnControllerName = ControllerName, ReturnActionName = nameof(Continue) }; return(View("PaymentCancel", cancelVm)); }
public IActionResult OneOffCancel(Guid id, PaymentOptionsStateVm paymentOptionsStateVm) { // Construct model for Cancel view var cancelVm = new ReturnToFormVm { State = paymentOptionsStateVm.FilledInState, StateFieldName = nameof(PaymentOptionsStateVm.FilledInState), StateType = nameof(PaymentOptionsVm), ReturnControllerName = ControllerName, ReturnActionName = nameof(Continue) }; return(View("PaymentCancel", cancelVm)); }