Example #1
0
 public static List <Reservation> GetAllReservationDate()
 {
     using (var context = new BusProjectEntities())
     {
         return(context.Reservations.ToList());
     }
 }
Example #2
0
 public Customer GetByLogid(string loginId)
 {
     using (var context = new BusProjectEntities())
     {
         return(context.Customers.FirstOrDefault(x => x.LoginId == loginId));
     }
 }
Example #3
0
 public Reservation GetByReservationId(int reservationId)
 {
     using (var context = new BusProjectEntities())
     {
         return(context.Reservations.FirstOrDefault(x => x.ReservationId == reservationId));
     }
 }
Example #4
0
        public List <Customer> GetManReservation()
        {
            using (var context = new BusProjectEntities())
            {
                var query = from x in context.Customers
                            select x;

                List <Customer> customers = query.ToList();

                foreach (Customer customer in customers)
                {
                    Seat seat = context.Seats.FirstOrDefault(x => x.CustomerId == customer.CustomerId);
                    customer.SeatColumn       = seat.SeatColumn;
                    customer.SeatColumnNumber = seat.SeatColumnNumber;
                    customer.PaymentMethod    = seat.PaymentMethod;

                    Operation operation = context.Operations.FirstOrDefault(x => x.OperationId == seat.OperationId);
                    customer.DepartureLocation = operation.DepartureLocation;
                    customer.ArrivalLocation   = operation.ArrivalLocation;
                    customer.OperationDate     = operation.OperationDate;

                    //customer.DepartureTime = operation.DepartureTime;

                    Route route = context.Routes.FirstOrDefault(x => x.RouteId == operation.RouteId);
                    customer.BusTypeId = route.BusTypeId;

                    Reservation reservation = context.Reservations.FirstOrDefault(x => x.RouteId == route.RouteId);
                    customer.ReservationDate = reservation.ReservationDate;
                }
                return(customers);
            }
        }
Example #5
0
 public List <string> GetArrivalCities(string arrival)
 {
     using (var context = new BusProjectEntities())
     {
         return(context.Routes.Select(x => x.ArrivalLocation).ToList());
     }
 }
Example #6
0
 public List <string> GetDepartureCities()
 {
     using (var context = new BusProjectEntities())
     {
         return(context.Routes.Select(x => x.DepartureLocation).ToList());
     }
 }
Example #7
0
 public static List <Route> GetByRouteId()
 {
     using (var context = new BusProjectEntities())
     {
         return(context.Routes.ToList());
     }
 }
Example #8
0
        public List <Operation> GetByOperationId(int operationId)
        {
            using (var context = new BusProjectEntities())
            {
                var query = from x in context.Operations
                            where x.OperationId == operationId
                            select x;

                return(query.ToList());
            }
        }
Example #9
0
        public List <Reservation> ReservationRouteId()
        {
            using (var context = new BusProjectEntities())
            {
                var query = from x in context.Reservations
                            select new { Reservation = x, RouteId = x.RouteId };
                var list = query.ToList();

                foreach (var item in list)
                {
                    item.Reservation.RouteId = item.RouteId;
                }
                return(list.ConvertAll(x => x.Reservation));
            }
        }
Example #10
0
        public List <Operation> GetManOperation()
        {
            using (var context = new BusProjectEntities())
            {
                var query = from x in context.Operations
                            select x;

                List <Operation> operations = query.ToList();

                foreach (Operation operation in operations)
                {
                    Route route = context.Routes.SingleOrDefault(x => x.RouteId == operation.RouteId);
                    operation.DepartureLocation = route.DepartureLocation;
                    operation.ArrivalLocation   = route.ArrivalLocation;
                    operation.BusTypeId         = route.BusTypeId;
                }
                return(operations);
            }
        }