示例#1
0
        public void WriteEntry(string logEntry)
        {
            var entry = new LogEntry();

            entry.EntryTime = DateTime.Now;
            entry.Message   = logEntry;

            _context.Entry(entry).State = EntityState.Added;
        }
 public void AddProduct(Product product)
 {
     _context.Entry(product).State = EntityState.Added;
     _logger.WriteEntry(string.Format("Product Added. SKU: '{0}', Name: '{1}', Price: '{2}', Stock: '{3}'", product.Sku, product.Name, product.Price, product.Stock));
 }