예제 #1
0
        public void AddSectionTypes()
        {
            using (BookingSystemDbContext context = new BookingSystemDbContext())
            {
                if (!context.FlightSectionTypes.Where(x => x.FlightSectionName == "First").Any())
                {
                    FlightSectionType first = new FlightSectionType()
                    {
                        FlightSectionName = "First"
                    };
                    context.FlightSectionTypes.Add(first);
                }
                if (!context.FlightSectionTypes.Where(x => x.FlightSectionName == "Economy").Any())
                {
                    FlightSectionType economy = new FlightSectionType()
                    {
                        FlightSectionName = "Economy"
                    };
                    context.FlightSectionTypes.Add(economy);
                }
                if (!context.FlightSectionTypes.Where(x => x.FlightSectionName == "Business").Any())
                {
                    FlightSectionType business = new FlightSectionType()
                    {
                        FlightSectionName = "Business"
                    };
                    context.FlightSectionTypes.Add(business);
                }

                context.SaveChanges();
            }
        }
 public AirportRepository(BookingSystemDbContext context)
 {
     this.context = context;
 }
 public AirportRepository()
 {
     this.context = new BookingSystemDbContext();
 }
예제 #4
0
 public FlightRepository(BookingSystemDbContext context)
 {
     this.context = context;
 }
예제 #5
0
 public FlightRepository()
 {
     this.context = new BookingSystemDbContext();
 }
예제 #6
0
 public SectionRepository(BookingSystemDbContext context)
 {
     this.context = context;
 }
예제 #7
0
 public SectionRepository()
 {
     this.context = new BookingSystemDbContext();
 }