예제 #1
0
        public IActionResult AddMovie([FromBody] Movie movie)
        {
            try
            {
                _logger.LogInformation($"api/Movies/CRUD:AddMovie: " +
                                       $"Movie: {movie.ToString()}");

                return(Ok(_businessLogicLayer.AddMovie(movie)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
예제 #2
0
        private static void TestAddMovieMovieMovie(string code)
        {
            Movie movie = null;

            Console.WriteLine($"Testing adding movie '{code}'.");

            movie = new Movie(code, @"Test Title Type", @"Test Prmay Title",
                              @"Test Original Title", false, (short?)2019, (short?)2020,
                              (int?)67, @"Test Genre");

            Console.WriteLine($"Add Success: {_businessLogicLayer.AddMovie(movie).ToString()}.");

            movie = _businessLogicLayer.ReadMovie(code);
            Console.WriteLine(@"New Movie:");
            Console.WriteLine(movie.ToString());
        }