Пример #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;
		}
Пример #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);
        }
Пример #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();
		}
Пример #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();
		}
Пример #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);
		}
Пример #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());
 }
Пример #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());
 }
Пример #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));
 }