public ActionResult Index()
        {
            _logger.LogInfo("Hey - I called the Home Page!!!!");
            ViewBag.Message = "Welcome to ASP.NET MVC!";

            var db = new LearnMVC3DBContext();
            var productions = db.Productions;
            var orders = db.Orders;

            var production = CreateNewProduction();
            var order = CreateNewOrder();

            productions.Add(production);
            orders.Add(order);

            try
            {
            int success = db.SaveChanges();

            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        _logger.LogInfo(string.Format("  > Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage));
                    }
                }
            }
            catch (Exception ex)
            {

                _logger.LogInfo(string.Format("Error DB: {0}", ex.Message));
            }

            //_logger.LogInfo(string.Format("Datatabase: {0}", ((IObjectContextAdapter)db).ObjectContext.Connection.ConnectionString));

            return View();
        }
 public DBFiller(LearnMVC3DBContext dbContext)
 {
     db = dbContext;
     productions = db.Productions;
     orders = db.Orders;
 }
 private void ClearFullTable(string table, LearnMVC3DBContext dbContext)
 {
     dbContext.Database.ExecuteSqlCommand(String.Format("delete from {0}", table));
 }