public ActionResult <Movie> AddMovie(string MovieName, int AgeRating, double Price, DateTime ReleaseDate, string Genre) { //return BadRequest(new { message = "Please enter the correct information to create a movie" }); //return Ok("add movie to database"); Movie movieInstance = new Movie() { MovieName = MovieName, AgeRating = AgeRating, Price = Price, ReleaseDate = ReleaseDate, Genre = Genre }; if (!Validation.ValidateMovie(movieInstance)) { return(BadRequest(new { message = "Please enter valid values" })); } try { // if result = 1 return Ok(MovieInstance); // Console.WriteLine("movie successfully created"); // return Ok(movieInstance); Console.WriteLine("user requested movie creation"); Movie returnedMovie = movieRepository.AddMovieToDB(MovieName, AgeRating, Price, ReleaseDate, Genre); Console.WriteLine("movie successfully created"); return(Ok(returnedMovie)); } catch (SqlException error) { Console.WriteLine("something went wrong"); return(StatusCode(500, error.ToString())); } }