示例#1
0
        private int UpdateMovieProducerMapping(MovieViewModel movieVm, out StringBuilder errors)
        {
            errors = new StringBuilder();
            int errorCount = 0;

            try
            {
                _mappingService.RemoveMovieProducerMap(_currentMovie.Id, movieVm.CurrentProducerId);
            }
            catch (Exception ex)
            {
                errorCount++;
                errors.Append("\nFailed to remove previous producer");
            }

            try
            {
                if (movieVm.NewProducer != null)
                {
                    _mappingService.AddMovieProducerMap(_currentMovie, movieVm.NewProducer);
                }
            }
            catch (Exception ex)
            {
                errorCount++;
                errors.Append("\nFailed to map producer to movie");
            }

            return(errorCount);
        }