public AirlineUnitOfWork(AirlineContext context)
 {
     this.context = context;
     Airlines     = new RepositoryAirline(context);
     Country      = new RepositoryCountry(context);
     Pilot        = new RepositoryPilot(context);
     Flight       = new RepositoryFlight(context);
 }
Exemple #2
0
        //Update race
        public static void UpdateRace(int raceID, int raceTeamID)
        {
            AirlineContext db = new AirlineContext();
            Race           a  = db.Races.Find(raceID);

            a.RaceTeamID = raceTeamID;
            db.SaveChanges();
        }
Exemple #3
0
 public RegisterViewModel(INavigation navigation, AirlineContext context)
 {
     _navigation   = navigation;
     _context      = context;
     _register     = new LoginRegisterService(context);
     SignUpCommand = new Command(Register);
     LoginCommand  = new Command(SignInPage);
 }
Exemple #4
0
 public LoginViewModel(INavigation navigation, AirlineContext context)
 {
     _navigation     = navigation;
     _context        = context;
     login           = new LoginRegisterService(context);
     LoginCommand    = new Command(Login);
     RegisterCommand = new Command(SignUpPage);
 }
Exemple #5
0
        static void Main(string[] args)
        {
            //Country c = new Country { Name="Serbia" };
            AirlineContext context = new AirlineContext();

            context.SaveChanges();
            context.Dispose();
        }
 public AddEditMealViewModel(INavigation navigation, AirlineContext context, Users users)
 {
     _navigation   = navigation;
     _context      = context;
     _boardServive = new DashBoardService(context);
     _currentUser  = users;
     SaveCommand   = new Command(Save);
     Title         = "Add New Meal";
 }
Exemple #7
0
        //Creating RaceTeamIDs list for selectlist
        public static IEnumerable <RaceTeam> PopulateRaceTeamDropDownList()
        {
            AirlineContext db = new AirlineContext();

            var departmentsQuery = from d in db.RaceTeams
                                   orderby d.ID
                                   select d;

            return(departmentsQuery);
        }
Exemple #8
0
 public DashBoardViewModel(INavigation navigation, AirlineContext context, Users users)
 {
     _navigation    = navigation;
     _context       = context;
     _boardServive  = new DashBoardService(context);
     AddMealCommand = new Command(AddMeal);
     _currentUser   = users;
     UserName       = _currentUser.Name;
     GetUserMeal();
 }
Exemple #9
0
 public MealListViewModel(INavigation navigation, AirlineContext context, Users users, Meals meal)
 {
     _navigation       = navigation;
     _context          = context;
     Meal              = meal;
     _currentUser      = users;
     _boardService     = new DashBoardService(_context);
     EditMealCommmand  = new Command(EditMeal);
     DeleteMealCommand = new Command(DeleteMeal);
 }
Exemple #10
0
        public AddEditMeal(AirlineContext context, Users currentUser, Meals meal)
        {
            InitializeComponent();
            var viewModel = new AddEditMealViewModel(Navigation, context, currentUser);

            if (meal != null)
            {
                viewModel.EditMode(meal);
            }
            BindingContext = viewModel;
        }
Exemple #11
0
 static void Main(string[] args)
 {
     using (var dbContext = new AirlineContext())
     {
         foreach (var samolot in dbContext.TypSamolotu)
         {
             Console.WriteLine($"done {samolot.IloscMiejsc}");
         }
         Console.ReadLine();
     }
 }
Exemple #12
0
        public static List <MealListViewModel> To(INavigation navigation, AirlineContext context, Users users, List <Meals> meals)
        {
            var destination = new List <MealListViewModel>();

            foreach (var meal in meals)
            {
                destination.Add(new MealListViewModel(navigation, context, users, meal));
            }

            return(destination);
        }
Exemple #13
0
        public static IEnumerable <CustomName> GetCustomRadiomen()
        {
            AirlineContext db = new AirlineContext();
            var            a  = (from s in db.RadioMen
                                 select new CustomName
            {
                Name = s.FirstName + " " + s.LastName,
                ID = s.ID
            }).ToList();

            return(a);
        }
Exemple #14
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library",
                                      "AirlineCateringDb.db");

            var _context = new AirlineContext(dbPath);

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App(_context));

            return(base.FinishedLaunching(app, options));
        }
 public override string[] GetRolesForUser(string username)
 {
     string[] roles = new string[] { };
     using (AirlineContext db = new AirlineContext())
     {
         // Getting user
         AuthEntities.User user = db.Users.Include(u => u.Role).FirstOrDefault(u => u.Username == username);
         if (user != null && user.Role != null)
         {
             // Getting role
             roles = new string[] { user.Role.Name };
         }
         return(roles);
     }
 }
Exemple #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            var dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
                                      "AirlineCateringDb.db");

            var _context = new AirlineContext(dbPath);

            _context.Database.EnsureCreatedAsync();
            _context.Database.EnsureCreated();

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App(_context));
        }
        public override bool IsUserInRole(string username, string roleName)
        {
            using (AirlineContext db = new AirlineContext())
            {
                // Getting user

                AuthEntities.User user = db.Users.Include(u => u.Role).FirstOrDefault(u => u.Username == username);

                if (user != null && user.Role != null && user.Role.Name == roleName)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Exemple #18
0
        //Updating of the stuardesses for RaceTeam
        public static void UpdateStuardesses(int?firstStuardess, int?secondStuardess, int raceTeamID)
        {
            AirlineContext db = new AirlineContext();

            RaceTeam b = db.RaceTeams.Include(i => i.Stuardesses).FirstOrDefault(i => i.ID == raceTeamID);

            b.Stuardesses.Clear();
            db.SaveChanges();
            Stuardess a = db.Stuardesses.FirstOrDefault(i => i.ID == firstStuardess);

            if (a != null)
            {
                b.Stuardesses.Add(a);
                db.SaveChanges();
            }
            a = db.Stuardesses.FirstOrDefault(i => i.ID == secondStuardess);
            if (a != null)
            {
                b.Stuardesses.Add(a);
                db.SaveChanges();
            }
        }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, AirlineContext context)
        {
            app.Use(async(ctx, next) =>
            {
                await next();
                if (ctx.Response.StatusCode == 204)
                {
                    ctx.Response.ContentLength = 0;
                }
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors(builder =>
                        builder.WithOrigins(Configuration["ApplicationSettings:Client_URL"].ToString())
                        .AllowAnyHeader()
                        .AllowAnyMethod()

                        );

            //app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            //AirlineDataIntializer.SeedAirlines(context);

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Exemple #20
0
 public TicketService(AirlineContext airlineContext, IMapper mapper)
 {
     _context = airlineContext;
     _mapper  = mapper;
 }
 public FlightRepository(AirlineContext db)
     : base(db)
 {
 }
Exemple #22
0
 public FlightController(AirlineContext context)
 {
     ctx = context;
 }
Exemple #23
0
 public AirlineController()
 {
     context = new AirlineContext();
 }
Exemple #24
0
 public AccountController(AirlineContext context)
 {
     _context = context;
 }
Exemple #25
0
 public AirportsController(AirlineContext context)
 {
     _context = context;
 }
 public CarNotReservedHandler(AirlineContext context)
 {
     _context = context;
 }
 public LoginRegisterService(AirlineContext airlineContext)
 {
     _airlineContext = airlineContext;
 }
Exemple #28
0
 public BookedTicketService(AirlineContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public GenericRepository(AirlineContext db)
 {
     this.db = db;
 }
 public Authentication(AirlineContext context)
 {
     this.context = context;
 }