Beispiel #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;
		}
Beispiel #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);
        }
Beispiel #3
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();
		}
Beispiel #4
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();
		}
Beispiel #5
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);
		}
Beispiel #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());
 }
Beispiel #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());
 }
Beispiel #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));
 }