Exemplo n.º 1
0
        public async Task ValuationServiceCompleted(int id)
        {
            var log = await context.ValuationLogs.FindAsync(id);

            log.FinishedOn = DateTime.Now;
            await context.SaveChangesAsync();
        }
Exemplo n.º 2
0
        public async Task Save(IEnumerable <CurrencyRate> currencyRates)
        {
            foreach (var rate in currencyRates)
            {
                var existing = context.CurrencyRates.Where(cr => cr.From == rate.From && cr.Day == rate.Day).ToList();
                context.CurrencyRates.RemoveRange(existing);
            }

            context.CurrencyRates.AddRange(currencyRates);
            await context.SaveChangesAsync();
        }
Exemplo n.º 3
0
        public async Task SetNotified(IEnumerable <int> listingIds)
        {
            var entities = await context.TargetPrices.Where(t => t.PriceReachedOn == null).ToListAsync();

            var toBeUpdated = entities.Where(e => listingIds.Any(lid => lid == e.ListingId)).ToList();

            foreach (var entity in toBeUpdated)
            {
                entity.PriceReachedOn = DateTime.Now.Date;
                entity.Notified       = true;
            }
            await context.SaveChangesAsync();
        }