public ActionResult LoadConsumption(int id)
        {
            var rooms = this.floors.GetRoomsByFloorId(id).ToList();
            var model = new ConsumptionStatisticViewModel();
            model.Statistics = new List<ConsumptionViewModel>();
            model.FloorNumber = this.floors.GetFloorNameById(id);

            foreach (var room in rooms)
            {
                var consumption = this.consumptions.GetConsumptionsByRoomId(room.Id).To<ConsumptionViewModel>().FirstOrDefault();
                if (consumption != null)
                {
                    consumption.RoomName = room.RoomName;
                    model.Statistics.Add(consumption);
                }
            }

            return this.PartialView("_ConsumptionInfoPartial", model);
        }
Beispiel #2
0
        public ActionResult LoadConsumption(int id)
        {
            var rooms = this.floors.GetRoomsByFloorId(id).ToList();
            var model = new ConsumptionStatisticViewModel();

            model.Statistics  = new List <ConsumptionViewModel>();
            model.FloorNumber = this.floors.GetFloorNameById(id);

            foreach (var room in rooms)
            {
                var consumption = this.consumptions.GetConsumptionsByRoomId(room.Id).To <ConsumptionViewModel>().FirstOrDefault();
                if (consumption != null)
                {
                    consumption.RoomName = room.RoomName;
                    model.Statistics.Add(consumption);
                }
            }

            return(this.PartialView("_ConsumptionInfoPartial", model));
        }