Exemplo n.º 1
0
        /// <summary>Gets the given request.</summary>
        ///
        /// <param name="request">The request.</param>
        ///
        /// <returns>A RestMoviesResponse.</returns>
        public RestMoviesResponse Get(RestMovies request)
		{
			var response = new RestMoviesResponse();

			DbFactory.Run(db =>
			{
				if (request.Id != null)
				{
					var movie = db.GetByIdOrDefault<RestMovie>(request.Id);
					if (movie != null)
					{
						response.Movies.Add(movie);
					}
				}
				else
				{
					response.Movies = db.Select<RestMovie>();
				}
			});

			return response;
		}
Exemplo n.º 2
0
        /// <summary>Gets the given request.</summary>
        ///
        /// <param name="request">The request.</param>
        ///
        /// <returns>A RestMoviesResponse.</returns>
        public RestMoviesResponse Get(RestMovies request)
        {
            var response = new RestMoviesResponse();

            DbFactory.Run(db =>
            {
                if (request.Id != null)
                {
                    var movie = db.GetByIdOrDefault <RestMovie>(request.Id);
                    if (movie != null)
                    {
                        response.Movies.Add(movie);
                    }
                }
                else
                {
                    response.Movies = db.Select <RestMovie>();
                }
            });

            return(response);
        }