Exemple #1
0
        public BankController(SpaContext context)
        {
            _context     = context;
            _contextSeed = context;

            if (_contextSeed.AcctItems.Count() == 0)
            {
                _contextSeed.AcctItems.Add(new AccountModel
                {
                    Id         = key++,
                    CustomerId = 1,
                    Balance    = 0.00,
                    Credit     = 100000.00
                });
                // _context.AcctItems.Add(new AccountModel { Id = 2, CustomerId = 1, Balance = 2.00, Credit = 200000.00 });
                _contextSeed.SaveChanges();
            }
        }
Exemple #2
0
        public static SpaContext GetContextWithData()
        {
            var options = new DbContextOptionsBuilder <SpaContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            var context = new SpaContext(options);

            context.Tasks.AddRange(
                new TaskBuilder().WithName("Some name1").WithDescription("Test desc1").Build(),
                new TaskBuilder().WithName("Some name2").WithDescription("Test desc2").Build(),
                new TaskBuilder().WithName("Completed task3").WithDescription("Test desc5").WithCompleted(true).Build(),
                new TaskBuilder().WithName("Some name4").WithDescription("Test desc4").Build(),
                new TaskBuilder().WithName("Deleted task5").WithDescription("Test desc5").WithDeleted(true).Build());

            context.SaveChanges();

            return(context);
        }
Exemple #3
0
 public HomeController(SpaContext context)
 {
     _context = context;
 }
Exemple #4
0
 public ServiceProviderRepository(SpaContext spaContext, IReadOnlySpaContext readOnlySpaContext)
 {
     _spaContext         = spaContext;
     _readOnlySpaContext = readOnlySpaContext;
 }
 public TaskRepository(SpaContext context) : base(context)
 {
 }
Exemple #6
0
 /// <summary>
 /// Default Constructor for UnitOfWork
 /// </summary>
 public UnitOfWork(SpaContext spaContext)
 {
     _context = spaContext;
 }
 public CustomerRepository(SpaContext spaContext, IReadOnlySpaContext readOnlySpaContext)
 {
     _spaContext         = spaContext;
     _readOnlySpaContext = readOnlySpaContext;
 }
 public ClientController(SpaContext context)
 {
     _context = context;
 }
 public CustomerRepository(SpaContext spaContext)
 {
     _spaContext = spaContext;
 }
        protected SpaContext _context; // Core's DI takes care about disposing it

        public BaseRepository(SpaContext context)
        {
            _context = context;
        }
Exemple #11
0
 public ContactController(SpaContext context)
 {
     _context = context;
 }
 public BlogsController(ContextFactory contextFactory)
 {
     _db = contextFactory.GetContext <SpaContext>();
 }
 public UnitOfWork()
 {
     Context = new SpaContext();
 }
 public TaskRepositoryTest()
 {
     _context = InMemoryDb.GetContextWithData();
     _repo    = new TaskRepository(_context);
 }
 public AppointmentRepository(SpaContext spaContext, IReadOnlySpaContext readOnlySpaContext)
 {
     _spaContext         = spaContext;
     _readOnlySpaContext = readOnlySpaContext;
 }
 public ServiceController(SpaContext context)
 {
     _context = context;
 }
Exemple #17
0
 public SpaContext Init()
 {
     return(_dbContext ?? (_dbContext = new SpaContext()));
 }