public void Init() { _dbContext = new FlightDbContext("FlightDbContext"); _bookingRep = new BookingRepository(_dbContext, new FlightRepository(_dbContext)); _lastBookingId = _dbContext.Bookings.Max(b => b.Id); _lastPassengerId = _dbContext.Passengers.Max(p => p.Id); }
private void CreateGraphics() { // Create a new graphics overlay to contain a variety of graphics. var planeTrailsOverlay = new GraphicsOverlay(); // Add the overlay to a graphics overlay collection. GraphicsOverlayCollection overlays = new GraphicsOverlayCollection { planeTrailsOverlay }; this.GraphicsOverlays = overlays; using (var db = new FlightDbContext()) { foreach (var item in db.Flights.Include("Status").Include("Trails").Where(f => f.ScanCompleted.Value)) { //&& !item.Status.Live.Value && item.Status.Text.Contains("Landed") if (item.Status != null) { // SampleShitDraw(item, planeTrailsOverlay); planeTrailsOverlay.Graphics.Add(GraphicFromFlight(item.Trails)); } } } }
public ActionResult Index() { var context = new FlightDbContext(); var UserID = User.Identity.GetUserName(); List <FlightPlanDetails> planes = context.Flights.Where(n => n.PilotID == UserID).ToList(); return(View(planes)); }
public static FlightDbContext Create() { if (_soleInstance == null) { _soleInstance = new FlightDbContext(); } return(_soleInstance); }
public InfoModel(FlightDbContext context) { this.context = context; FlightType = new List <FlightType>(); foreach (var flightType in context.FlightTypes) { FlightType.Add(flightType); } }
public RegisterModel( UserManager <FlightUser> userManager, SignInManager <FlightUser> signInManager, FlightDbContext context) { _userManager = userManager; _signInManager = signInManager; _context = context; }
public FlightPlanControllerTests() { string[] args = { }; var h = Program.CreateHostBuilder(args); var d = new DbContextOptionsBuilder <FlightDbContext>(); d.UseInMemoryDatabase("DBName"); flightDBContextMock = new FlightDbContext(d.Options); sut = new FlightPlanController(flightDBContextMock); }
public ActionResult UpdateFlightPlan(string id) { var db = new PlanesDbContext(); var db1 = new FlightDbContext(); ViewBag.PlaneID = new SelectList(db.Planes.Where(n => n.isAllotted == false), "PlaneID", "PlaneID"); var flight = db1.Flights.FirstOrDefault(n => n.PlaneID == id); return(View(flight)); }
public ActionResult UpdateFlightPlan(FlightPlanDetails flightPlan) { PlanesDbContext db = new PlanesDbContext(); var db1 = new FlightDbContext(); ViewBag.PlaneID = new SelectList(db.Planes.Where(n => n.isAllotted == false), "PlaneID", "PlaneID"); var flight = db1.Flights.FirstOrDefault(n => n.PlaneID == flightPlan.PlaneID); db1.SaveChanges(); return(View()); }
public UsersController(FlightDbContext context) { this.context = context; }
public EditModel(FlightDbContext context) { _context = context; }
public BookingRepository(FlightDbContext dbContext, IFlightRepository flightRep) { _dbCtx = dbContext; _flightRep = flightRep; }
public CategoryRepository(FlightDbContext dbContext) { _context = dbContext; _categories = dbContext.Categories; }
public SearchEntryRepository(FlightDbContext dbContext, SearchEntryMapper mapper) : base(dbContext, mapper) { }
public SignUpController(FlightDbContext context) { _context = context; }
public ViewRecordController(FlightDbContext context, IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; _context = context; }
public AirportRepository(FlightDbContext dbContext, AirportMapper mapper) : base(dbContext, mapper) { }
public void TestMethod1() { //Arrage var options = new DbContextOptionsBuilder <FlightDbContext>(). UseInMemoryDatabase(databaseName: "dummy").Options; List <Segment> segs1 = new List <Segment>(); segs1.Add(new Segment() { ID = 1, Latitude = 10, Longitude = 10, TimespanSeconds = 100 }); List <Segment> segs2 = new List <Segment>(); List <Segment> segs3 = new List <Segment>(); List <Segment> segs4 = new List <Segment>(); InitialLocation init1 = new InitialLocation() { ID = 1, Latitude = 10, Longitude = 10, DateTime = new System.DateTime() }; InitialLocation init2 = new InitialLocation(); InitialLocation init3 = new InitialLocation(); InitialLocation init4 = new InitialLocation(); FlightPlan fp1 = new FlightPlan() { FlightID = "AX100", CompanyName = "OneLine", InitialLocation = init1, Passengers = 123, Segments = segs1 }; FlightPlan fp2 = new FlightPlan() { CompanyName = "TwoLine", InitialLocation = init2, Passengers = 456, Segments = segs2 }; FlightPlan fp3 = new FlightPlan() { CompanyName = "ThreeLine", InitialLocation = init3, Passengers = 679, Segments = segs3 }; FlightPlan fp4 = new FlightPlan() { CompanyName = "FourLine", InitialLocation = init4, Passengers = 84, Segments = segs4 }; //Act using (var context = new FlightDbContext(options)) { context.FlightPlan.Add(fp1); context.SaveChanges(); } //Assert using (var context = new FlightDbContext(options)) { var controller = new FlightPlanController(context); var flights = controller.GetFlightPlan("AX100"); var returnedID = (flights.Result.Value as FlightPlan).FlightID; Assert.AreEqual(fp1.FlightID, (flights.Result.Value as FlightPlan).FlightID); } }
public FlightView(FlightDbContext dbContext) { _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext)); }
public PassengerRepository(FlightDbContext dbContext) { _context = dbContext; _passengers = dbContext.Passengers; }
public FlightRepository(FlightDbContext dbContext) { _dbCtx = dbContext; }
public IndexModel(FlightDbContext context) { this.context = context; }
public FlightRepository(FlightDbContext flightDbContext) { _flightDbContext = flightDbContext; }
public StewardRepository(FlightDbContext dbContext) { _context = dbContext; _stewards = dbContext.Stewards; }
public FlightsController(FlightDbContext c) { context = c; }
public OrderRepository(FlightDbContext dbContext) { _context = dbContext; _orders = dbContext.Orders; }
public FlightsController(FlightDbContext context) { _context = context; }
public FlightRepository(FlightDbContext dbContext) { _context = dbContext; _flights = dbContext.Flights; }
public HomeController(FlightDbContext context, IHttpContextAccessor httpContextAccessor) { _httpContextAccessor = httpContextAccessor; _context = context; }
public ProductRepository(FlightDbContext dbContext) { _context = dbContext; _products = dbContext.Products; }