Sample Code/MovieHunter.API/Controllers/MoviesController.cs
/// <summary>
/// Retrieves a single from the repository
/// with the defined title
/// </summary>
/// <returns></returns>
/// <example>GET api/movies/5</example>
Retrieves a single from the repository
with the defined title
Retrieves a single from the repository with the defined title
[ResponseType(typeof(Movie))]
        public IHttpActionResult Get(string title)
        {
            try
            {
                Movie movie;
                var moviesRepository = new Models.MovieRepository();
                var movies = moviesRepository.Retrieve();
                movie = movies.FirstOrDefault(t => t.Title == title);
                if (movie == null)
                {
                    return NotFound();
                }
                return Ok(movie);
            }
            catch (Exception ex)
            {
                return InternalServerError(ex);
            }
        }
[ ResponseType ( typeof ( Movie ) ) ] public IHttpActionResult Get ( string title ) { try { Movie movie ; var moviesRepository = new Models . MovieRepository ( ) ; var movies = moviesRepository . Retrieve ( ) ; movie = movies . FirstOrDefault ( t => t . Title == title ) ; if ( movie == null ) { return NotFound ( ) ; } return Ok ( movie ) ; } catch ( Exception ex ) { return InternalServerError ( ex ) ; } }
Retrieves a single from the repository
with the defined title
Retrieves a single from the repository with the defined title
None
title
string
example
None