예제 #1
0
        public TourDay GetLatestTourDay(int TourId)
        {
            DateTime today = _dateTime.getToday();

            TourDay tourDay = _context.TourDay.Where(r => r.TourId == TourId && r.TourDate <= today).OrderByDescending(r => r.TourDate).FirstOrDefault();

            if (tourDay == null)
            {
                tourDay = _context.TourDay.Where(r => r.TourId == TourId && r.TourDate > today).OrderBy(r => r.TourDate).FirstOrDefault();
            }
            return(tourDay);
        }
예제 #2
0
        public IEnumerable <TeeTimeInfo> getAll()
        {
            var TeeTimes = _context.TeeTime.Where(r => r.TeeTimeTS >= _dateTime.getToday()).OrderBy(r => r.TeeTimeTS);

            List <TeeTimeInfo> TeeTimeInfos = new List <TeeTimeInfo>();

            foreach (TeeTime teeTime in TeeTimes)
            {
                Member member = _context.Member.FirstOrDefault(r => r.MemberId == teeTime.ReservedById);
                Course course = _context.Course.FirstOrDefault(r => r.CourseId == teeTime.CourseId);
                List <TeeAssignInfo> teeAssignInfos = _teeAssignInfo.getForTeeTime(teeTime.TeeTimeId);
                TeeTimeInfo          teeTimeInfo    = new TeeTimeInfo(teeTime, member, course, teeAssignInfos);

                TeeTimeInfos.Add(teeTimeInfo);
            }
            return(TeeTimeInfos);
        }
예제 #3
0
 public Tour getLatestTour()
 {
     return(_context.Tour.Where(r => r.TourType == TourType.SingleDay &&
                                r.TourDate <= _dateTime.getToday().AddDays(20)).OrderByDescending(r => r.TourDate).FirstOrDefault());
 }