public void EditAirLineInfo(ATLTravelPortal.Areas.Airline.Models.AirLines obj)
        {
            var result = ent.Airlines.Where(x => x.AirlineId == obj.AirLineId).FirstOrDefault();

            if (result != null)
            {
                result.AirlineName = obj.txtAirLineName;
                result.Photo       = obj.Photo;
                result.AirlineCode = obj.AirLineCode;
                ent.ApplyCurrentValues(result.EntityKey.EntitySetName, result);
                ent.SaveChanges();
            }
        }
        //public IQueryable<Airlines> GetAllSearchAirlineNameList(string AirlineNameCode, int pageNo, out int currentPageNo, out int numberOfPages, int? flag)
        //{
        //    int pageSize = (int)PageSize.JePageSize;
        //    int rowCount = ent.Airlines.Count();
        //    numberOfPages = (int)Math.Ceiling((decimal)rowCount / (decimal)pageSize);
        //    if (flag != null)//Checking for next/Previous
        //    {
        //        if (flag == 1)
        //            if (pageNo != 1) //represents previous
        //                pageNo -= 1;
        //        if (flag == 2)
        //            if (pageNo != numberOfPages)//represents next
        //                pageNo += 1;

        //    }
        //    currentPageNo = pageNo;
        //    int rowsToSkip = (pageSize * currentPageNo) - pageSize;
        //    IQueryable<Airlines> pagingdata = ent.Airlines.Where(x => (x.AirlineName.ToLower().Contains(AirlineNameCode.ToLower()) || x.AirlineCode.ToLower().Contains(AirlineNameCode.ToLower()))).Take(pageSize).AsQueryable();
        //    return pagingdata;
        //}

        //public IQueryable<Airlines> GetAllSearchAirlineNameList(string AirlineNameCode)
        //{
        //    IQueryable<Airlines> result = ent.Airlines.Where(x => (x.AirlineName.ToLower().Contains(AirlineNameCode.ToLower()) || x.AirlineCode.ToLower().Contains(AirlineNameCode.ToLower()))).AsQueryable();
        //    return result;
        //}

        public IQueryable <ATLTravelPortal.Areas.Airline.Models.AirLines> GetAllSearchAirlineNameList(string AirlineNameCode)
        {
            var result = ent.Airlines.Where(x => (x.AirlineName.ToLower().Contains(AirlineNameCode.ToLower()) || x.AirlineCode.ToLower().Contains(AirlineNameCode.ToLower())));
            List <ATLTravelPortal.Areas.Airline.Models.AirLines> model = new List <ATLTravelPortal.Areas.Airline.Models.AirLines>();

            foreach (var item in result)
            {
                ATLTravelPortal.Areas.Airline.Models.AirLines obj = new ATLTravelPortal.Areas.Airline.Models.AirLines
                {
                    AirLineId      = item.AirlineId,
                    txtAirLineName = item.AirlineName,
                    AirLineCode    = item.AirlineCode
                };
                model.Add(obj);
            }
            return(model.AsQueryable());
        }
        public IQueryable <ATLTravelPortal.Areas.Airline.Models.AirLines> GetAllInActiveDomesticAirline()
        {
            List <ATLTravelPortal.Areas.Airline.Models.AirLines> obj = new List <ATLTravelPortal.Areas.Airline.Models.AirLines>();
            var result = ent.Airlines.Where(x => x.AirlineTypeId == 2 && x.isActive == false).OrderBy(x => x.AirlineId).AsQueryable();

            foreach (var item in result)
            {
                ATLTravelPortal.Areas.Airline.Models.AirLines model = new ATLTravelPortal.Areas.Airline.Models.AirLines()
                {
                    txtAirLineName = item.AirlineName,
                    AirLineCode    = item.AirlineCode,
                    AirLineId      = item.AirlineId
                };
                obj.Add(model);
            }
            return(obj.AsQueryable());
        }
        //public IQueryable<Airlines> GetAllInActiveAirlineByByPaging(int pageNo, out int currentPageNo, out int numberOfPages, int? flag)
        //{
        //    int pageSize = (int)PageSize.JePageSize;
        //    int rowCount = ent.Airlines.Where(x => x.isActive == false).Count();
        //    numberOfPages = (int)Math.Ceiling((decimal)rowCount / (decimal)pageSize);
        //    if (flag != null)//Checking for next/Previous
        //    {
        //        if (flag == 1)
        //            if (pageNo != 1) //represents previous
        //                pageNo -= 1;
        //        if (flag == 2)
        //            if (pageNo != numberOfPages)//represents next
        //                pageNo += 1;

        //    }
        //    currentPageNo = pageNo;
        //    int rowsToSkip = (pageSize * currentPageNo) - pageSize;
        //    IQueryable<Airlines> pagingdata = ent.Airlines.OrderBy(t => t.AirlineId).Where(x => x.isActive == false).Skip(rowsToSkip).Take(pageSize).AsQueryable();
        //    return pagingdata;
        //}
        //public IQueryable<Airlines> GetAllInActiveAirline()
        //{
        //    IQueryable<Airlines> result = ent.Airlines.OrderBy(t => t.AirlineId).Where(x => x.isActive == false).AsQueryable();
        //    return result;
        //}

        //public IQueryable<AirLines.Models.AirLine.AirLines> GetAllAirlineByByPagings(int pageNo, out int currentPageNo, out int numberOfPages, int? flag)
        //{
        //    int pageSize = (int)PageSize.JePageSize;
        //    int rowCount = ent.Airlines.Count();
        //    numberOfPages = (int)Math.Ceiling((decimal)rowCount / (decimal)pageSize);
        //    if (flag != null)//Checking for next/Previous
        //    {
        //        if (flag == 1)
        //            if (pageNo != 1) //represents previous
        //                pageNo -= 1;
        //        if (flag == 2)
        //            if (pageNo != numberOfPages)//represents next
        //                pageNo += 1;

        //    }
        //    currentPageNo = pageNo;
        //    int rowsToSkip = (pageSize * currentPageNo) - pageSize;
        //    List<AirLines.Models.AirLine.AirLines> obj = new List<AirLines.Models.AirLine.AirLines>();
        //    var result = ent.Airlines.OrderBy(t => t.AirlineId).Skip(rowsToSkip).Take(pageSize).AsQueryable();
        //    foreach (var item in result)
        //    {
        //        AirLines.Models.AirLine.AirLines model = new AirLines.Models.AirLine.AirLines()
        //        {
        //            txtAirLineName = item.AirlineName,
        //            AirLineCode = item.AirlineCode,
        //            Photo = item.Photo,
        //            AirLineId = item.AirlineId
        //        };
        //        obj.Add(model);
        //    }
        //    //IQueryable<Airlines> pagingdata = ent.Airlines.OrderBy(t => t.AirlineId).Skip(rowsToSkip).Take(pageSize).AsQueryable();
        //    return obj.AsQueryable();
        //}

        public IQueryable <ATLTravelPortal.Areas.Airline.Models.AirLines> GetAllAirline()
        {
            List <ATLTravelPortal.Areas.Airline.Models.AirLines> obj = new List <ATLTravelPortal.Areas.Airline.Models.AirLines>();
            var result = ent.Airlines.OrderBy(t => t.AirlineId).AsQueryable();

            foreach (var item in result)
            {
                ATLTravelPortal.Areas.Airline.Models.AirLines model = new ATLTravelPortal.Areas.Airline.Models.AirLines()
                {
                    txtAirLineName = item.AirlineName,
                    AirLineCode    = item.AirlineCode,
                    AirLineId      = item.AirlineId
                };
                obj.Add(model);
            }
            return(obj.AsQueryable());
        }
        public IQueryable <ATLTravelPortal.Areas.Airline.Models.AirLines> GetAllInactiveAirLinesList()
        {
            var result = ent.Airlines.OrderBy(x => x.AirlineName).Where(x => x.isActive == false).OrderBy(x => x.AirlineName).OrderBy(x => x.AirlineName);
            List <ATLTravelPortal.Areas.Airline.Models.AirLines> model = new List <ATLTravelPortal.Areas.Airline.Models.AirLines>();

            foreach (var item in result)
            {
                ATLTravelPortal.Areas.Airline.Models.AirLines obj = new ATLTravelPortal.Areas.Airline.Models.AirLines
                {
                    AirLineId      = item.AirlineId,
                    txtAirLineName = item.AirlineName,
                    AirLineCode    = item.AirlineCode
                };
                model.Add(obj);
            }
            return(model.AsQueryable());
        }
        public IQueryable <ATLTravelPortal.Areas.Airline.Models.AirLines> GetAllInActiveInternationalAirlineList()
        {
            var result = ent.Airlines.OrderBy(x => x.AirlineName).Where(x => x.isActive == false && x.AirlineTypeId == 1).OrderBy(x => x.AirlineName);
            List <ATLTravelPortal.Areas.Airline.Models.AirLines> model = new List <ATLTravelPortal.Areas.Airline.Models.AirLines>();

            foreach (var item in result)
            {
                ATLTravelPortal.Areas.Airline.Models.AirLines obj = new ATLTravelPortal.Areas.Airline.Models.AirLines
                {
                    AirLineId      = item.AirlineId,
                    txtAirLineName = item.AirlineName,
                    AirLineCode    = item.AirlineCode,
                    CountryName    = item.Countries.CountryName
                };
                model.Add(obj);
            }
            return(model.AsQueryable());
        }
        //public AirLineModel GetAirLineInfoById(int AirlineId)
        //{

        //    Airlines result = ent.Airlines.Where(x => x.AirlineId == AirlineId).FirstOrDefault();
        //    AirLineModel model = new AirLineModel();
        //    model.AirlineCode = result.AirlineCode;
        //    model.AirlineName = result.AirlineName;
        //    model.Photo = result.Photo;
        //    model.chkSettlement = Convert.ToBoolean(result.SettlmentLedgerId);
        //    model.AccTypes = (int)result.SettlmentLedgerId;
        //    model.BSPorConsolidatorId = (int)result.SettlmentLedgerId;
        //    model.AirlineTypId = result.AirlineTypeId;

        //    return model;


        //}


        public ATLTravelPortal.Areas.Airline.Models.AirLines GetAirLineInfoByIds(int AirlineId)
        {
            List <ATLTravelPortal.Areas.Airline.Models.AirLines> obj = new List <ATLTravelPortal.Areas.Airline.Models.AirLines>();
            //obj = ent.Airlines.Where(x => x.AirlineId == AirlineId).ToList();
            var result = ent.Airlines.Where(x => x.AirlineId == AirlineId);

            foreach (var item in result)
            {
                ATLTravelPortal.Areas.Airline.Models.AirLines model = new ATLTravelPortal.Areas.Airline.Models.AirLines()
                {
                    AirLineCode    = item.AirlineCode,
                    AirLineId      = item.AirlineId,
                    txtAirLineName = item.AirlineName,
                    Photo          = item.Photo
                };
                obj.Add(model);
            }
            return(obj.FirstOrDefault());
        }
        public IQueryable <ATLTravelPortal.Areas.Airline.Models.AirLines> GetAllSearchAirlineNameLists(string AirlineNameCode, int pageNo, out int currentPageNo, out int numberOfPages, int?flag)
        {
            int pageSize = (int)PageSize.JePageSize;
            int rowCount = ent.Airlines.Count();

            numberOfPages = (int)Math.Ceiling((decimal)rowCount / (decimal)pageSize);
            if (flag != null)//Checking for next/Previous
            {
                if (flag == 1)
                {
                    if (pageNo != 1) //represents previous
                    {
                        pageNo -= 1;
                    }
                }
                if (flag == 2)
                {
                    if (pageNo != numberOfPages)//represents next
                    {
                        pageNo += 1;
                    }
                }
            }
            currentPageNo = pageNo;
            int rowsToSkip = (pageSize * currentPageNo) - pageSize;
            List <ATLTravelPortal.Areas.Airline.Models.AirLines> obj = new List <ATLTravelPortal.Areas.Airline.Models.AirLines>();
            var result = ent.Airlines.Where(x => (x.AirlineName.ToLower().Contains(AirlineNameCode.ToLower()) || x.AirlineCode.ToLower().Contains(AirlineNameCode.ToLower()))).Take(pageSize).AsQueryable();

            foreach (var item in result)
            {
                ATLTravelPortal.Areas.Airline.Models.AirLines model = new ATLTravelPortal.Areas.Airline.Models.AirLines()
                {
                    txtAirLineName = item.AirlineName,
                    AirLineCode    = item.AirlineCode,
                    Photo          = item.Photo,
                    AirLineId      = item.AirlineId
                };
                obj.Add(model);
            }
            // IQueryable<Airlines> pagingdata = ent.Airlines.Where(x => (x.AirlineName.ToLower().Contains(AirlineNameCode.ToLower()) || x.AirlineCode.ToLower().Contains(AirlineNameCode.ToLower()))).Take(pageSize).AsQueryable();
            return(obj.AsQueryable());
        }
        public IEnumerable <ATLTravelPortal.Areas.Airline.Models.AirLines> GetAllAirlineNameLists(string AirlineNameCode, int maxResult)
        {
            List <ATLTravelPortal.Areas.Airline.Models.AirLines> obj = new List <ATLTravelPortal.Areas.Airline.Models.AirLines>();
            var result = ent.Airlines.Where(x => (x.AirlineName.ToLower().Contains(AirlineNameCode.ToLower()) || x.AirlineCode.ToLower().Contains(AirlineNameCode.ToLower()))).Take(maxResult).ToList().
                         Select(x => new Airlines {
                AirlineName = x.AirlineName, AirlineId = x.AirlineId, AirlineCode = x.AirlineCode
            });

            foreach (var item in result)
            {
                ATLTravelPortal.Areas.Airline.Models.AirLines model = new ATLTravelPortal.Areas.Airline.Models.AirLines
                {
                    txtAirLineName = item.AirlineName,
                    AirLineId      = item.AirlineId,
                    AirLineCode    = item.AirlineCode
                };
                obj.Add(model);
            }
            return(obj.AsEnumerable());
        }