public object Get(RestMovies request)
        {
            var response = new RestMoviesResponse();

            using (var db = DbFactory.Open())
            {
                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
        public object Get(RestMovies request)
        {
            var response = new RestMoviesResponse();

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

            return(response);
        }
 public object Post(RestMovies request)
 {
     using (var db = DbFactory.Open())
         db.Update(request.Movie);
     return new RestMoviesResponse();
 }
 public object Delete(RestMovies request)
 {
     using (var db = DbFactory.Open())
         db.DeleteById<RestMovie>(request.Id);
     return new RestMoviesResponse();
 }
Beispiel #5
0
 public object Post(RestMovies request)
 {
     using (var db = DbFactory.Open())
         db.Update(request.Movie);
     return(new RestMoviesResponse());
 }
Beispiel #6
0
 public object Delete(RestMovies request)
 {
     using (var db = DbFactory.Open())
         db.DeleteById <RestMovie>(request.Id);
     return(new RestMoviesResponse());
 }