Пример #1
0
        private void ItemExpired(Items item)
        {
            var stMessage = "Item " + item.Label + " expired at " + item.Expiration.ToString();

            _logger.LogInformation(stMessage);
            _context.Remove(item);
            _context.SaveChanges();

            //remove timer reference from dictionary
            TimerReferences.Remove(item.Label);
        }
Пример #2
0
        private static void SeedTestData(InventoryApiContext context)
        {
            var testItem1 = new Models.Items
            {
                Label      = "TestLabel1",
                Expiration = DateTime.Now.AddYears(1),
                ItemType   = 1
            };

            context.Items.Add(testItem1);

            var testItem2 = new Models.Items
            {
                Label      = "TestLabel2",
                Expiration = DateTime.Now.AddYears(1),
                ItemType   = 1
            };

            context.Items.Add(testItem2);
            context.SaveChanges();
        }