コード例 #1
0
        public TimeTableIndexWithRoutesViewModel GetModelWithRoutes(Direction direction, DayType day, int?lineId)
        {
            var line = this.Db.Lines
                       .Where(x => x.Id == lineId)
                       .Include(x => x.Routes)
                       .FirstOrDefault();

            if (line == null)
            {
                return(null);
            }

            var model = new TimeTableIndexWithRoutesViewModel
            {
                Day       = day.ToString(),
                Direction = direction.ToString(),
                LineId    = line.Id,
                Tab       = "0"
            };
            var routes = line.Routes
                         .Where(x => x.Direction == direction && x.DayType == day)
                         .Select(x => new RouteViewModel
            {
                Id        = x.Id,
                RouteName = x.RouteName
            }).ToList();

            model.Routes = routes;
            return(model);
        }
コード例 #2
0
 public EmployeeTimeModel()
 {
     HourTypes = new Dictionary <string, decimal>();
     for (DayType d = DayType.Workday; d <= DayType.Other; d++)
     {
         HourTypes.Add(d.ToString(), 0);
     }
 }