Esempio n. 1
0
        public HolidaySearchModel FindById(int holidayId)
        {
            var result = _context.Holidays.Where(v => v.HolidayId == holidayId);

            result = (IQueryable <Holiday>)ExpandOperator.ExpandRelatedEntities <Holiday>(result);

            var holiday       = result.FirstOrDefault();
            var holidaySearch = HolidayOperator.SetHolidaySearchModelCascade(holiday);

            return(holidaySearch);
        }
Esempio n. 2
0
        public IEnumerable <HolidaySearchModel> GetAll()
        {
            var queryData = from H in _context.Holidays
                            select H;

            var result = QueryOperate <Holiday> .Execute(queryData);

            result = (IQueryable <Holiday>)ExpandOperator.ExpandRelatedEntities <Holiday>(result);

            //以下执行完后才会去数据库中查询
            var holidays       = result.ToList();
            var holidaysSearch = HolidayOperator.SetHolidaySearchModelCascade(holidays);

            return(holidaysSearch);
        }