public async Task DropDB() { using (var context = new MssqlContext()) { await context.Database.EnsureDeletedAsync(); } }
static async Task <IEnumerable <string> > GetVehicles() { using (var dbContext = new MssqlContext()) { return(await(from v in dbContext.Vehicles select v.VIN).ToListAsync()); } }
public void Store(Hero hero) { using (var context = new MssqlContext()) { context.Entry(hero).State = ((hero.ID == 0) ? (EntityState.Added) : (EntityState.Modified)); context.SaveChanges(); } }
public void Remove(Hero hero) { using (var context = new MssqlContext()) { context.Entry(hero).State = EntityState.Deleted; context.SaveChanges(); } }
public void Add(Hero hero) { using (var context = new MssqlContext()) { context.Heroes.Add(hero); context.SaveChanges(); } }
public async Task CreateDB() { MssqlContext.ConnectionString = ConnectionString; using (var context = new MssqlContext()) { await context.Database.EnsureCreatedAsync(); } }
public Hero Load(Hero hero) { if (!Exists(hero)) { throw new Exception($"There's no such hero with ID: {hero.ID}"); } using (var context = new MssqlContext()) { return(context.Heroes.Find(hero.ID)); } }
public IList <Hero> GetList() { using (var context = new MssqlContext()) { var query = from h in context.Heroes select h; var heroes = query.ToList <Hero>(); return(heroes); } }
public IList <User> GetList() { using (var context = new MssqlContext()) { var querry = from f in context.Users select f; var users = querry.ToList <User>(); return(users); } }
public bool Exists(Hero hero) { using (var context = new MssqlContext()) { //var query = from h in context.Heroes // where h.Name == hero.Name // select h; IQueryable <Hero> query = BuildQuery(context.Heroes, hero); var exists = query.Any <Hero>(); return(exists); } }
public IList <Hero> FindList(Hero hero) { using (var context = new MssqlContext()) { //var query = from h in context.Heroes // where h.Name == hero.Name // select h; IQueryable <Hero> query = BuildQuery(context.Heroes, hero); var heroes = query.ToList <Hero>(); return(heroes); } }
public async Task TestVehicleGetsConnectedAfterPing() { var vehiclesDataIntoDB = TestData.GetVehicles(); using (var dbContext = new MssqlContext()) { dbContext.Vehicles.AddRange(vehiclesDataIntoDB); await dbContext.SaveChangesAsync(); } var vehicleMonitoringService = new VehicleMonitoringService(new VehiclesRepository(), TimeSpan.FromMilliseconds(50)); await vehicleMonitoringService.Init(); var apiController = new VehiclesStatusController(vehicleMonitoringService); var vehiclesStatusInfo = await apiController.Monitoring(); Assert.IsTrue(vehiclesStatusInfo.Count() == vehiclesDataIntoDB.Count(), "Count of vehicles in db and returned from api does not match"); }
public PhoneRepository(MssqlContext context) : base(context) { }
public SellerRepository(MssqlContext context, UserManager <ApplicationUser> userManager) : base(context) { _userManager = userManager; }
public ShippingCompanyRepository(MssqlContext context) : base(context) { }
public CollegeRepository(MssqlContext context) : base(context) { }
public TypeGenericRepository(MssqlContext context) : base(context) { }
public BaseRepository(MssqlContext context) { Context = context; }
public AddressRepository(MssqlContext context) : base(context) { }