52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using TIAM.Entities.TransferDestinations;
|
|
using TIAMWebApp.Shared.Application.Interfaces;
|
|
using TIAMWebApp.Shared.Application.Models;
|
|
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<TModelType?> ProcessWizardAsync<TModelType>(Type type, object data) where TModelType: class
|
|
{
|
|
switch (type.Name)
|
|
{
|
|
case "TransferDestinationWizardModel":
|
|
var result = await transferDataService.CreateTransferDestination((TransferDestination)data);
|
|
return result as TModelType;
|
|
|
|
//var a = new WizardProcessorResult<TransferDestination>();
|
|
//a.Model = result;
|
|
//return a as TResult;
|
|
|
|
case "ServiceProvider":
|
|
return null;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|