コード例 #1
0
        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);
        }
コード例 #2
0
        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"));
            }
        }