コード例 #1
0
        public void RemoveRequest(User user, Room r)
        {
            Room room = Db.Rooms.Find(r);

            if (room != null)
            {
                UserRoom userroom = new UserRoom();
                userroom.User   = user;
                userroom.Room   = room;
                userroom.RoomId = room.RoomId;
                userroom.UserId = user.UserId;
                room.Requests.Remove(userroom);
                user.RequstedRooms.Remove(userroom);
                Db.SaveChanges();
            }
        }
コード例 #2
0
        public Room DeleteRoom(Room room)
        {
            var user = Db.Users.Find(room.OwnerId);

            //user.Rooms.Remove(room);
            Db.Rooms.Remove(room);
            Db.SaveChanges();
            return(room);
        }