Beispiel #1
0
        public bool CancelTickets(string tktId)
        {
            if (string.IsNullOrEmpty(tktId))
            {
                return(false);
            }

            var            dbCtx   = new AirlineReservationEntities();
            Ticketing_Info cnclTkt = dbCtx.Ticketing_Info.Find(tktId);

            if (cnclTkt == null)
            {
                return(false);
            }

            cnclTkt.status = "X";
            dbCtx.SaveChanges();
            return(true);
        }
Beispiel #2
0
        public bool BookTickets(int schId, int fareId, int custId)
        {
            string tktId = DateTime.Now.ToString("ddMMMyyhhmmss");

            try
            {
                var            dbCtx   = new AirlineReservationEntities();
                Ticketing_Info tktInfo = new Ticketing_Info()
                {
                    ticket_id = tktId, Fare_Id = fareId, cust_id = custId, schedule_id = schId, status = "C"
                };

                dbCtx.Ticketing_Info.Add(tktInfo);
                int saved = dbCtx.SaveChanges();
                return(saved > 0);
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }