コード例 #1
0
        public List <DeviceWrapper> GetWrappers(int deviceId)
        {
            List <DeviceWrapper> wrappers = new List <DeviceWrapper>();

            List <DBSchema> schemas = dbContext.timeschema.Where(p => p.DeviceId == deviceId)
                                      .OrderByDescending(x => x.DayOfWeek)
                                      .OrderByDescending(z => z.TimePoint).ToList();

            foreach (DBSchema schema in schemas)
            {
                DBDevice d = dbContext.devices.Find(schema.DeviceId);

                DeviceWrapper wrap = new DeviceWrapper
                                     (
                    new Schema
                    (
                        new Device()
                {
                    DeviceId          = d.deviceID,
                    DeviceDescription = d.DeviceType,
                    DeviceName        = d.DeviceName
                }
                    )
                {
                    WeekDay    = schema.DayOfWeek,
                    ActionText = schema.Action.ToString(),
                    TimePoint  = schema.TimePoint
                });

                wrappers.Add(wrap);
            }

            return(wrappers);
        }
コード例 #2
0
        //
        // GET: /Device/

        public ActionResult Index()
        {
            return(View(DBDevice.GetDevice(4)));
        }