49 lines
1.7 KiB
C#
49 lines
1.7 KiB
C#
using TIAM.Entities.TransferDestinations;
|
|
using TIAMWebApp.Shared.Application.Interfaces;
|
|
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
|
|
|
namespace TIAMMobileApp.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<string> 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<string> 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();
|
|
}
|
|
}
|
|
}
|