示例#1
0
        public IActionResult EditRoom(int id)
        {
            Room r = dc.getAllRooms().FirstOrDefault(r => r.id == id);
            RoomDashboardRegulatedViewModel model = new RoomDashboardRegulatedViewModel(r);

            return(View(model));
        }
示例#2
0
        public IActionResult EditRoom(RoomDashboardRegulatedViewModel model)
        {
            if (ModelState.IsValid)
            {
                Room r = new Room(model);
                dc.updateRoom(r);

                return(Redirect("/Home/ManageRooms"));
            }

            return(View(model));
        }
示例#3
0
        public IActionResult CreateRoom()
        {
            if (loggedUser == null)
            {
                return(NotFound());
            }
            if (loggedUser.isAdmin == false)
            {
                return(NotFound());
            }

            RoomDashboardRegulatedViewModel model = new RoomDashboardRegulatedViewModel();

            return(View(model));
        }
        public IActionResult EditRoom(int id)
        {
            if (HomeController.loggedUser is null)
            {
                return(NotFound());
            }
            if (HomeController.loggedUser.isAdmin == false)
            {
                return(NotFound());
            }

            Room r = ds.getFirstEntry <Room>(r => r.id == id);
            RoomDashboardRegulatedViewModel model = new RoomDashboardRegulatedViewModel(r);

            return(View(model));
        }
示例#5
0
        public IActionResult CreateRoom(RoomDashboardRegulatedViewModel model)
        {
            if (loggedUser == null)
            {
                return(NotFound());
            }
            if (loggedUser.isAdmin == false)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                Room r = new Room(model);
                dc.addRoom(r);

                return(RedirectToAction(nameof(ManageRooms)));
            }

            return(View(model));
        }
        public IActionResult EditRoom(RoomDashboardRegulatedViewModel model)
        {
            if (HomeController.loggedUser is null)
            {
                return(NotFound());
            }
            if (HomeController.loggedUser.isAdmin == false)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                Room r = new Room(model);
                ds.updateEntry(r);

                return(Redirect("/Dashboard/ManageRooms"));
            }

            return(View(model));
        }