private void UpdateDirectorMovies(Director dir, string movieName) { dir.DirectedMovies.Add(movieName); var dirMov = dir.DirectedMovies.Distinct().ToList(); dir.DirectedMovies = dirMov; dirService.UpdateDirector(dir.Name, dir); }
public async Task <IHttpActionResult> PutAsync(string directorName, [FromBody] DirectorCompleteModelIN newDirector) { await Task.Yield(); if (directorName == "" || newDirector == null) { return(BadRequest("Director name can not be empty")); } try { directorService.UpdateDirector(directorName, newDirector.ToEntity()); return(Ok(newDirector)); } catch (DataBaseException) { return(Content(HttpStatusCode.NotFound, $"{directorName} does not exist in our database")); } }