/// <summary> /// POST /movies /// </summary> public object Post(Movie movie) { var newMovieId = DbFactory.Run(db => { db.Insert(movie); return(db.GetLastInsertId()); }); var newMovie = new MovieResponse { Movie = DbFactory.Run(db => db.GetById <Movie>(newMovieId)) }; return(new HttpResult(newMovie) { StatusCode = HttpStatusCode.Created, Headers = { { HttpHeaders.Location, this.RequestContext.AbsoluteUri.WithTrailingSlash() + newMovieId } } }); }
/// <summary> /// POST /movies /// </summary> public object Post(Movie movie) { var newMovieId = DbFactory.Run(db => { db.Insert(movie); return db.GetLastInsertId(); }); var newMovie = new MovieResponse { Movie = DbFactory.Run(db => db.GetById<Movie>(newMovieId)) }; return new HttpResult(newMovie) { StatusCode = HttpStatusCode.Created, Headers = { { HttpHeaders.Location, this.RequestContext.AbsoluteUri.WithTrailingSlash() + newMovieId } } }; }