/// <summary> /// Maps a single aggregate data source to the UI datasource /// returned by the web service, including any additional links /// </summary> /// <param name="id">the Windfarm Data Source</param> /// <param name="result">the Windfarm Data Source</param> /// <param name="generator">The instance of the Link Generator</param> /// <returns>UI data source and links</returns> public ImportInfo MapSource(int id, bool result, IImportLinkGenerator generator) { if (id == 0) return new ImportInfo(); var importinfo = new ImportInfo() { Result = (result) ? "Resource successfully imported" : "Resource not imported, Invalid source countent", Links = generator.GenerateItemLinks(id) }; return importinfo; }
private readonly IHttpRequestHelper _helper; // Helper class /// <summary> /// Ctor: Accepts injected dataservice /// </summary> /// <param name="dataService">The DataService instance being injected</param> /// <param name="mapper"></param> /// <param name="generator">The Hypermedia link generator</param> /// <param name="helper">The helper class instance</param> public ImportController(IDataService dataService, IImportMapper mapper, IImportLinkGenerator generator, IHttpRequestHelper helper) { if (dataService == null) throw new ArgumentNullException("dataService", "No valid dataservice supplied to the controller."); if (mapper == null) throw new ArgumentNullException("mapper", "No valid mapper supplied to the controller."); if (generator == null) throw new ArgumentNullException("generator", "No valid link generator supplied to the controller."); if (helper == null) throw new ArgumentNullException("helper", "No valid helper supplied to the controller."); _service = dataService; _mapper = mapper; _generator = generator; _helper = helper; }