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(); } }
public Room DeleteRoom(Room room) { var user = Db.Users.Find(room.OwnerId); //user.Rooms.Remove(room); Db.Rooms.Remove(room); Db.SaveChanges(); return(room); }