/// <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;
		}
Exemple #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);
        }
        /// <summary>Post this message.</summary>
        ///
        /// <param name="request">The request.</param>
        ///
        /// <returns>A RestMoviesResponse.</returns>
        public RestMoviesResponse Post(RestMovies request)
		{
            DbFactory.Run(db => db.Update(request.Movie));
			return new RestMoviesResponse();
		}
        /// <summary>Deletes the given request.</summary>
        ///
        /// <param name="request">The request.</param>
        ///
        /// <returns>A RestMoviesResponse.</returns>
        public RestMoviesResponse Delete(RestMovies request)
		{
            DbFactory.Run(db => db.DeleteById<RestMovie>(request.Id));
			return new RestMoviesResponse();
		}
        /// <summary>Anies the given request.</summary>
        ///
        /// <param name="request">The request.</param>
        ///
        /// <returns>A RestMoviesResponse.</returns>
        public RestMoviesResponse Any(RestMovies request)
		{
			return Get(request);
		}
Exemple #6
0
 /// <summary>Post this message.</summary>
 ///
 /// <param name="request">The request.</param>
 ///
 /// <returns>A RestMoviesResponse.</returns>
 public RestMoviesResponse Post(RestMovies request)
 {
     DbFactory.Run(db => db.Update(request.Movie));
     return(new RestMoviesResponse());
 }
Exemple #7
0
 /// <summary>Deletes the given request.</summary>
 ///
 /// <param name="request">The request.</param>
 ///
 /// <returns>A RestMoviesResponse.</returns>
 public RestMoviesResponse Delete(RestMovies request)
 {
     DbFactory.Run(db => db.DeleteById <RestMovie>(request.Id));
     return(new RestMoviesResponse());
 }
Exemple #8
0
 /// <summary>Anies the given request.</summary>
 ///
 /// <param name="request">The request.</param>
 ///
 /// <returns>A RestMoviesResponse.</returns>
 public RestMoviesResponse Any(RestMovies request)
 {
     return(Get(request));
 }