public virtual string ProcessData(ExampleDataObject dataObject) { if (!ModelState.IsValid) { throw ResponseBuilderService.GenerateValidationResponse(ModelState); } var exampleDataProcessor = ExampleDataProcessors.FirstOrDefault(p => p.CanProcess(dataObject)); if (exampleDataProcessor == null) { throw ResponseBuilderService.GenerateErrorResponse("No Suitable Processor Found"); } return(exampleDataProcessor.Process(dataObject)); }
public bool CanProcess(ExampleDataObject dataObject) { return(dataObject.Source == "Third Source"); }
public string Process(ExampleDataObject dataObject) { return(dataObject.Data); }