Exemplo n.º 1
0
 public void Remove(Movie movie)
 {
     using (var client = new HttpClient())
     {
         HttpResponseMessage response =
             client.DeleteAsync(ServerAddress.Address + "movie/" + movie.Id).Result;
     }
 }
Exemplo n.º 2
0
 public void Update(Movie movie)
 {
     using (var client = new HttpClient())
     {
         HttpResponseMessage response =
             client.PutAsJsonAsync(ServerAddress.Address + "movie/", movie).Result;
     }
 }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
 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");
 }
Exemplo n.º 5
0
 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");
 }