Esempio n. 1
0
        public ActionResult Detail(int id)
        {
            Environment environment = _environmentDao.GetById(id);

            InitViewBag();
            return(View(environment));
        }
        public ActionResult Rooms(int environmentId, int?selectedRoom)
        {
            List <Room> rooms = _environmentDao.GetById(environmentId).Rooms.ToList();

            if (selectedRoom.HasValue)
            {
                ViewBag.roomSelected = selectedRoom;
            }
            return(PartialView("Rooms", rooms));
        }
Esempio n. 3
0
        public ActionResult Edit(Room room, int environmentId, int categoryId)
        {
            if (ModelState.IsValid)
            {
                Room roo = _roomDao.GetById(room.Id);

                roo.Code        = room.Code;
                roo.Name        = room.Name;
                roo.Floor       = room.Floor;
                roo.Category    = _roomCategoryDao.GetById(categoryId);
                roo.Purpouse    = room.Purpouse;
                roo.Environment = _environmentDao.GetById(environmentId);

                _roomDao.Update(roo);
                return(RedirectToAction("Index", "Room"));
            }

            InitViewBag();
            return(View("Detail", room));
        }
Esempio n. 4
0
        public ActionResult Rooms(int environmentId)
        {
            List <Room> rooms       = _environmentDao.GetById(environmentId).Rooms.ToList();
            List <Room> roomsReturn = new List <Room>();

            foreach (Room room in rooms)
            {
                roomsReturn.Add(new Room {
                    Id = room.Id, Name = room.Name
                });
            }
            return(Json(roomsReturn));
        }