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);
 }
예제 #2
0
        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);
        }
예제 #5
0
 public InfoModel(FlightDbContext context)
 {
     this.context = context;
     FlightType   = new List <FlightType>();
     foreach (var flightType in context.FlightTypes)
     {
         FlightType.Add(flightType);
     }
 }
예제 #6
0
 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());
        }
예제 #10
0
 public UsersController(FlightDbContext context)
 {
     this.context = context;
 }
예제 #11
0
 public EditModel(FlightDbContext context)
 {
     _context = context;
 }
 public BookingRepository(FlightDbContext dbContext, IFlightRepository flightRep)
 {
     _dbCtx     = dbContext;
     _flightRep = flightRep;
 }
예제 #13
0
 public CategoryRepository(FlightDbContext dbContext)
 {
     _context    = dbContext;
     _categories = dbContext.Categories;
 }
예제 #14
0
 public SearchEntryRepository(FlightDbContext dbContext, SearchEntryMapper mapper)
     : base(dbContext, mapper)
 {
 }
예제 #15
0
 public SignUpController(FlightDbContext context)
 {
     _context = context;
 }
예제 #16
0
 public ViewRecordController(FlightDbContext context, IHttpContextAccessor httpContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
     _context             = context;
 }
예제 #17
0
 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);
            }
        }
예제 #19
0
 public FlightView(FlightDbContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
예제 #20
0
 public PassengerRepository(FlightDbContext dbContext)
 {
     _context    = dbContext;
     _passengers = dbContext.Passengers;
 }
예제 #21
0
 public FlightRepository(FlightDbContext dbContext)
 {
     _dbCtx = dbContext;
 }
예제 #22
0
 public IndexModel(FlightDbContext context)
 {
     this.context = context;
 }
 public FlightRepository(FlightDbContext flightDbContext)
 {
     _flightDbContext = flightDbContext;
 }
예제 #24
0
 public StewardRepository(FlightDbContext dbContext)
 {
     _context  = dbContext;
     _stewards = dbContext.Stewards;
 }
 public FlightsController(FlightDbContext c)
 {
     context = c;
 }
예제 #26
0
 public OrderRepository(FlightDbContext dbContext)
 {
     _context = dbContext;
     _orders  = dbContext.Orders;
 }
예제 #27
0
 public FlightsController(FlightDbContext context)
 {
     _context = context;
 }
예제 #28
0
 public FlightRepository(FlightDbContext dbContext)
 {
     _context = dbContext;
     _flights = dbContext.Flights;
 }
예제 #29
0
 public HomeController(FlightDbContext context, IHttpContextAccessor httpContextAccessor)
 {
     _httpContextAccessor = httpContextAccessor;
     _context             = context;
 }
예제 #30
0
 public ProductRepository(FlightDbContext dbContext)
 {
     _context  = dbContext;
     _products = dbContext.Products;
 }