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; } }
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; } }
public void Delete(Movie movie) { using (var client = new HttpClient()) { HttpResponseMessage response = client.DeleteAsync("http://localhost:44334/api/movie/" + movie.Id).Result; } }
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(); }