public BookController(BasicDbContext dbContext) //constructor { this.dbContext = dbContext; //untuk inisialisasi object BasicDbContext if (this.dbContext.Books.Count() == 0) { this.dbContext.Books.Add(new Book { Id = 1, Date = DateTime.UtcNow, Title = "Harry Potter" }); this.dbContext.Books.Add(new Book { Id = 2, Date = DateTime.UtcNow, Title = "Sherlock Holmes" }); this.dbContext.Books.Add(new Book { Id = 3, Date = DateTime.UtcNow, Title = "The Lord of the Ring" }); this.dbContext.Books.Add(new Book { Id = 4, Date = DateTime.UtcNow, Title = "Assassins Creed" }); this.dbContext.SaveChanges(); } }
public BooksController(BasicDbContext dbContext) { this.dbContext = dbContext; if (this.dbContext.Books.Count() == 0) { this.dbContext.Books.Add(new Book { Date = DateTime.UtcNow, Title = "Hello There!" }); this.dbContext.Books.Add(new Book { Date = DateTime.UtcNow, Title = "Hello You!" }); this.dbContext.Books.Add(new Book { Date = DateTime.UtcNow, Title = "11:11" }); this.dbContext.Books.Add(new Book { Date = DateTime.UtcNow, Title = "Konspirasi Alam Semesta" }); this.dbContext.SaveChanges(); } }
public MovieController(BasicDbContext dbContext) { this.dbContext = dbContext; if (this.dbContext.Movies.Count() == 0) { this.dbContext.Movies.Add(new Movie { DurationInHour = 2, Title = "HarryPotter" }); this.dbContext.SaveChanges(); } }
public BooksController(BasicDbContext dbContext) { this.dbContext = dbContext; if (this.dbContext.Books.Count() == 0) { this.dbContext.Books.Add(new Book { Id = 1, Date = DateTime.UtcNow, Title = "Hello There!" }); this.dbContext.SaveChanges(); } }
public BasicDataFixture() { var builder = new DbContextOptionsBuilder <BasicDbContext>() .UseInMemoryDatabase($"{Guid.NewGuid()}") .ConfigureWarnings(w => w.Ignore(InMemoryEventId.TransactionIgnoredWarning)); Context = new BasicDbContext(builder.Options); Context.Database.EnsureCreated(); SeedContext(); builder = new DbContextOptionsBuilder <BasicDbContext>() .UseSqlServer("Crappy connection string"); FailureContext = new BasicDbContext(builder.Options); }
public BookController(BasicDbContext dbContext) { this.dbContext = dbContext; if (this.dbContext.Books.Count() == 0) { this.dbContext.Books.Add(new Book { Id = 1, Date = DateTime.UtcNow, Title = "Harry Potter" }); this.dbContext.Books.Add(new Book { Id = 2, Date = DateTime.UtcNow, Title = "Dilan" }); this.dbContext.SaveChanges(); } }
public NoteRepository(BasicDbContext context) { _Context = context; }
public CategoryRepository(BasicDbContext sampleDbContext) : base(sampleDbContext) { }
public RestaurantesController(BasicDbContext context) { _context = context; }
public KVController(BasicDbContext context) { _context = context; _context.Database.EnsureCreated(); }
public UserController(BasicDbContext _context) { this._context = _context; _context.Database.EnsureCreated(); }
public HomeController(BasicDbContext Context) { this.Context = Context; }
public UserRepository(BasicDbContext sampleDbContext) : base(sampleDbContext) { }
public ProductRepository(BasicDbContext sampleDbContext) : base(sampleDbContext) { }
public SessionRepository(BasicDbContext sampleDbContext) : base(sampleDbContext) { }