コード例 #1
0
 public Movie Add(Movie movie)
 {
     using (var client = new HttpClient())
     {
         HttpResponseMessage response =
             client.PostAsJsonAsync("http://localhost:4835/api/movie/", movie).Result;
         return response.Content.ReadAsAsync<Movie>().Result;
     }
 }
コード例 #2
0
ファイル: MovieGatewayService.cs プロジェクト: kriahja/MovieS
 public Movie Update(Movie movie)
 {
     using (var client = new HttpClient())
     {
         HttpResponseMessage response =
             client.PutAsJsonAsync("http://localhost:44334/api/movie/" + movie.Id, movie).Result;
         return response.Content.ReadAsAsync<Movie>().Result;
     }
 }
コード例 #3
0
ファイル: MovieGatewayService.cs プロジェクト: kriahja/MovieS
        public void Delete(Movie movie)
        {
            using (var client = new HttpClient())
            {
                HttpResponseMessage response =
                    client.DeleteAsync("http://localhost:44334/api/movie/" + movie.Id).Result;

            }
        }
コード例 #4
0
        public ActionResult Create()
        {
            /*
            For adding Genre to the create movie:

            List<Movie> movieList = facade.GetMovieRepository().ReadAll();
            List<Genre> genreList = facade.GetGenresRepository().ReadAll();
            List<ICollection> list = new List<ICollection>();
            list.Add(movieList);
            list.Add(genreList);
            */
            Movie movie = new Movie() {Genres = new List<Genre>(), PictureUrl = "pic2", Price = 2200, Rating = 2, ReleaseDate = DateTime.Now, Title = "The movie", TrailerUrl = "url1"};
            facade.GetMovieGateway().Add(movie);
            return View();
        }