Exemple #1
0
        public IActionResult Register(RegisterRoomViewModel newRoom)
        {
            bool result = roomServices.CreateNewRoom(newRoom);

            if (!result)
            {
                return(View(newRoom));
            }
            else
            {
                return(Redirect("/Room/All/"));
            }
        }
Exemple #2
0
        public bool CreateNewRoom(RegisterRoomViewModel newRoom)
        {
            //throw new NotImplementedException();
            Room room = new Room
            {
                Capacity      = newRoom.Capacity,
                RoomType      = newRoom.RoomType,
                FreeRoom      = newRoom.FreeRoom,
                PricePerAdult = newRoom.PricePerAdult,
                PricePerKid   = newRoom.PricePerKid,
                RoomNumber    = newRoom.RoomNumber
            };

            this.context.Rooms.Add(room);
            this.context.SaveChanges();
            room = GetRoom(room.Id);
            if (room is null)
            {
                return(false);
            }
            return(true);
        }