public void Remove(Movie movie) { using (var client = new HttpClient()) { HttpResponseMessage response = client.DeleteAsync(ServerAddress.Address + "movie/" + movie.Id).Result; } }
public void Update(Movie movie) { using (var client = new HttpClient()) { HttpResponseMessage response = client.PutAsJsonAsync(ServerAddress.Address + "movie/", movie).Result; } }
public List<Genre> GetGenresByMovie(Movie mov) { using (var client = new HttpClient()) { HttpResponseMessage response = client.GetAsync(ServerAddress.Address + "genresbymovie?=id=" + mov.Id).Result; return response.Content.ReadAsAsync<List<Genre>>().Result; } }
public ActionResult Edit(Movie Mov, string[] Genres) { foreach (var item in Genres) { if (!Mov.Genres.Contains(facade.GetGenreRep().GetGenreById(int.Parse(item)))){//denne linje virker ikke... :( Mov.Genres.Add(facade.GetGenreRep().GetGenreById(int.Parse(item))); } } facade.GetMovieRep().Update(Mov); return Redirect("index"); }
public ActionResult Create(Movie Movie, string[] Genres) { foreach (var item in Genres) { Movie.Genres.Add(facade.GetGenreRep().GetGenreById(int.Parse(item))); } int Year = Convert.ToInt32(Movie.Year.Year); int Month = Convert.ToInt32(Movie.Year.Month); int Day = Convert.ToInt32(Movie.Year.Day); Movie.Year = new DateTime(Year, Month, Day); facade.GetMovieRep().Add(Movie); return Redirect("index"); }