using TIAM.Entities.TransferDestinations; using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels; namespace TIAMWebApp.Client.Services { public class WizardProcessor : IWizardProcessor { public ITransferDataService transferDataService { get; set; } public IUserDataService userDataService { get; set; } public WizardProcessor(ITransferDataService transferDataService, IUserDataService userDataService) { this.transferDataService = transferDataService; this.userDataService = userDataService; } public async Task ProcessWizardAsync(Type type, object data) { switch (type.Name) { case "TransferDestinationWizardModel": var result = await transferDataService.CreateTransferDestination((TransferDestinationWizardModel)data); if (result) return "Success"; else return "Failed"; case "ServiceProvider": default: return "Not implemented"; } } public Task ValidateWizardStepAsync(Type type, string fieldName, object fieldValue) { //if type is TransferDestination, then validate the field name //if (type.Name == "TransferDestination") // return await TransferDataService.ValidateDestination(fieldName); //if type is ServiceProvider, then validate the field name //if type is something else, then throw an exception throw new NotImplementedException(); } } }