public IActionResult Get(string id) { repository = WorkSessionRepository.GetRepo(); IWorkSession item; repository.TryGetById(id, out item); if (!repository.TryGetById(id, out item)) { return(new NotFoundResult()); } return(new OkObjectResult(System.IO.File.ReadAllText(item.ResultFileName))); }
public async Task <IActionResult> Post() { FileInfo source = null; FileInfo filter = null; repository = WorkSessionRepository.GetRepo(); try { FileInfo[] fileInfos = await ReadFileStream(); if (fileInfos.Length == 0) { return(new NoContentResult()); } source = fileInfos[0]; if (fileInfos.Length == 1) { return(new NoContentResult()); } filter = fileInfos[1]; ModelService environment = SessionWorker.GetNewEnvironment(); IWorkSession sessionResult = environment .GetNew <ISessionWorker>(environment) .Run(source.FullName, filter.FullName) .GetResult(); IWorkSession result = repository.InsertNew(sessionResult); FileInfo resultFileInfo = new FileInfo(result.ResultFileName); List <string[]> content = Consume(resultFileInfo); CleanUploads(fileInfos); return(new OkObjectResult(content.ToArray())); } catch (HttpRequestException) { return(new NoContentResult()); } }
public WorkSessionController(IWorkSessionRepository dataRepository) { _dataRepository = dataRepository; }
public IEnumerable <IWorkSession> Get() { repository = WorkSessionRepository.GetRepo(); return(WorkSessionRepository.GetRepo().GetAll()); }