Пример #1
0
        /// <summary>
        /// Получение интервала начала и конца текущего месяца и года
        /// </summary>
        private static IntervalDates GetIntervalDates()
        {
            var intervalDates = new IntervalDates();

            GetIntervalDates(out intervalDates.beginDate, out intervalDates.endDate);
            return(intervalDates);
        }
Пример #2
0
        public JsonResult GetIntervals(int?locationId)
        {
            IntervalDates[] intDates = new IntervalDates[7];
            if (locationId > 0)
            {
                using (RatesDBContext ctx = new RatesDBContext())
                {
                    for (int i = 1; i <= 6; i++)
                    {
                        Update updt = ctx.Updates.Where(w => w.LocationId == locationId && w.IntervalNum == i).OrderByDescending(o => o.UpdateTime).FirstOrDefault();
                        if (updt != null)
                        {
                            intDates[i] = new IntervalDates {
                                PuDate = updt.PickupTime, DoDate = updt.DropoffTime
                            }
                        }
                        ;
                    }
                }
            }

            return(new JsonResult()
            {
                Data = intDates,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }