public IActionResult UpdateMovieInfo([FromBody] Movie updatedMovieInfo, long id)
        {
            try
            {
                var newMovieUtils = new MovieUtils();
                updatedMovieInfo.MovieId = id;
                var result = newMovieUtils.UpdateMovieInfo(updatedMovieInfo);

                if (result)
                {
                    return(Ok());
                }
                return(BadRequest("Couldnt Update the Movie Info! :'( "));
            }
            catch (Exception e)
            {
                return(BadRequest("Something Broke while updating the Movie Info!! " + e));
            }
        }
Пример #2
0
        public IActionResult UpdateMovieInfo([FromBody] Movie updatedMovieInfo, long id)
        {
            if (updatedMovieInfo == null)
            {
                var newMovieUtils = new MovieUtils();

                var lookedUpMovie = newMovieUtils.GetMovieById(id);
                try
                {
                    if (lookedUpMovie.Title != null)
                    {
                        return(new ObjectResult(lookedUpMovie));
                    }
                    return(NotFound($"There was no movie '{id}' found!"));
                }
                catch (Exception e)
                {
                    return(StatusCode(500, $"Couldnt find the movie you Specified ({id})! " + e));
                }
            }
            else
            {
                try
                {
                    var newMovieUtils = new MovieUtils();
                    updatedMovieInfo.MovieId = id;
                    var result = newMovieUtils.UpdateMovieInfo(updatedMovieInfo);

                    if (result)
                    {
                        return(Ok());
                    }
                    return(BadRequest("Couldnt Update the Movie Info! :'( "));
                }
                catch (Exception e)
                {
                    return(BadRequest("Something Broke while updating the Movie Info!! " + e));
                }
            }
        }