public Model.Customer AddCustomer(Model.Customer customer) { _context.Customers.Add( new Entity.Customer { FirstName = customer.FirstName, LastName = customer.LastName, Birthdate = customer.Birthdate, PhoneNumber = customer.PhoneNumber, Email = customer.Email, MailAddress = customer.MailAddress } ); _context.SaveChanges(); Log.Information("DL persisted customer add to DB"); return(customer); }
private void Seed() { using (var productContext = new Entity.MochaMomentDBContext(options)) { productContext.Database.EnsureDeleted(); productContext.Database.EnsureCreated(); productContext.Products.AddRange( new Entity.Product { ProductId = 1, ItemName = "Mocha", Price = 1.99, Description = "Mocha?" }, new Entity.Product { ProductId = 2, ItemName = "Frost", Price = 3.49, Description = "Frost?" } ); productContext.SaveChanges(); } }