Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public TaskResult Process(ImportMode importMode)
        {
            _importHistoryRepository.Add(new ImportHistory("broker-transactions", "broker.service"));

            var importTrackers = _importTrackerRepository
                                 .GetAll()
                                 .GetData <List <ImportTracker> >()
                                 .ToList();

            if (importMode == ImportMode.Retry)
            {
                importTrackers = importTrackers.FindAll(importTracker =>
                                                        importTracker.Status.Equals("Retry", StringComparison.CurrentCultureIgnoreCase));
            }

            var imports = _importRepository
                          .GetAll()
                          .Result
                          .GetData <List <Import> >()
                          .ToList();

            imports = imports.FindAll(import => !importTrackers.Contains(new ImportTracker(import.Symbol)));


            var taskResult = new TaskResult {
                IsSuccessful = true
            };

            taskResult.SetData(imports);
            return(taskResult);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public TaskResult Process()
        {
            _importHistoryRepository.Add(new ImportHistory("broker-transactions", "broker.service"));

            var importTrackers = _importTrackerRepository
                                 .GetAll()
                                 .GetData <List <ImportTracker> >()
                                 .Where(x => x.Status != "Retry");

            var imports = _importRepository
                          .GetAll()
                          .Result
                          .GetData <List <Import> >()
                          .Where(import => !importTrackers.Contains(new ImportTracker(import.Symbol)))
                          .OrderBy(i => i.Symbol)
                          .ToList();

            var taskResult = new TaskResult {
                IsSuccessful = true
            };

            taskResult.SetData(imports);
            return(taskResult);
        }
Ejemplo n.º 3
0
 public async Task <ActionResult <IEnumerable <Import> > > GetAll(
     [FromServices] IImportRepository repository
     )
 {
     return(Ok(await repository.GetAll()));
 }
Ejemplo n.º 4
0
 public IEnumerable <Import> GetAll()
 {
     return(_importRepository.GetAll());
 }