public void AsociateDirectorMovie(Movie movie, Director director) { lock (asociationLock) { if (movie.Director.Equals(director)) { throw new BussinesLogicException("La pelicula ya tiene el director"); } movie.Director = director.Name; director.DirectedMovies.Add(movie.Name); associationHandler.UpdateMovieDirector(movie, director); } }
public void AsociateDirectorMovie(Movie movie, Director director) { try { semaphore.WaitAsync(); if (movie.Director.Equals(director)) { throw new BussinesLogicException("La pelicula ya tiene el director"); } movie.Director = director.Name; director.DirectedMovies.Add(movie.Name); associationHandler.UpdateMovieDirector(movie, director); } finally { semaphore.Release(); } }