Esempio n. 1
0
 public DTO.Movie AddMovie(DTO.Movie m)
 {
     m.MovieId = movieIDs;
     movieIDs++;;
     movies.Add(m);
     return(m);
 }
Esempio n. 2
0
 public DTO.Movie SelectMovie(int id)
 {
     DTO.Movie selectmovie = null;
     foreach (DTO.Movie m in movies.ToList())
     {
         if (m.MovieId == id)
         {
             selectmovie = m;
         }
     }
     return(selectmovie);
 }
Esempio n. 3
0
 public MockCinemaManager()
 {
     movieIDs          = 0;
     movieeventIDs     = 0;
     movies            = new List <DTO.Movie>();
     roommanager       = new RoomManager();
     movieevents       = new List <DTO.MovieEvent>();
     movieeventheaders = new List <DTO.MovieEventHeader>();
     DTO.Movie m1 = new DTO.Movie()
     {
         Title = "Venom", Director = "Ruben Fleischer"
     };
     DTO.Movie m2 = new DTO.Movie()
     {
         Title = "Az első ember", Director = "Damien Chazelle"
     };
     DTO.Movie m3 = new DTO.Movie()
     {
         Title = "Egy kis szívesség", Director = "Paul Feig"
     };
     AddMovie(m1);
     AddMovie(m2);
     AddMovie(m3);
     DTO.Room r = new DTO.Room()
     {
         RoomNumber = 5, Capacity = 20
     };
     DTO.Room r2 = new DTO.Room()
     {
         RoomNumber = 4, Capacity = 30
     };
     roommanager.CreateRoom(r);
     roommanager.CreateRoom(r2);
     DTO.MovieEvent me1 = new DTO.MovieEvent();
     me1.Movie = m1;
     me1.Room  = roommanager.SelectRoom(r.RoomId);
     me1.Time  = new DateTime(2018, 10, 16, 14, 00, 00);
     DTO.MovieEvent me2 = new DTO.MovieEvent();
     me2.Movie = m2;
     me2.Room  = roommanager.SelectRoom(r.RoomId);
     me2.Time  = new DateTime(2018, 10, 16, 18, 00, 00);
     DTO.MovieEvent me3 = new DTO.MovieEvent();
     me3.Movie = m3;
     me3.Room  = roommanager.SelectRoom(r2.RoomId);
     me3.Time  = new DateTime(2018, 10, 17, 18, 00, 00);
     AddMovieEvent(me1);
     AddMovieEvent(me2);
     AddMovieEvent(me3);
     AddMovieEventHeader(movieevents.ElementAt(0));
     AddMovieEventHeader(movieevents.ElementAt(1));
     AddMovieEventHeader(movieevents.ElementAt(2));
 }
Esempio n. 4
0
 public DTO.Movie EditMovie(DTO.Movie m)
 {
     using (var client = new HttpClient())
     {
         client.BaseAddress = new Uri("http://localhost:6544/");
         var response = client.PutAsJsonAsync <DTO.Movie>("api/movie", m).Result;
         if (response.IsSuccessStatusCode)
         {
             return(SelectMovie(m.MovieId));
         }
         return(null);
     }
 }
Esempio n. 5
0
 public DTO.Movie AddMovie(DTO.Movie m)
 {
     using (var client = new HttpClient())
     {
         client.BaseAddress = new Uri("http://localhost:6544/");
         var response = client.PostAsJsonAsync <DTO.Movie>("api/movie", m).Result;
         if (response.IsSuccessStatusCode)
         {
             return(response.Content.ReadAsAsync <DTO.Movie>().Result);
         }
         return(null);
     }
 }
Esempio n. 6
0
        public DTO.Movie EditMovie(DTO.Movie m)
        {
            int i = -1;

            for (i = 0; i < movies.Count; i++)
            {
                if (movies.ElementAt(i).MovieId == m.MovieId)
                {
                    movies.ElementAt(i).Director = m.Director;
                    movies.ElementAt(i).Title    = m.Title;
                }
            }
            return(movies.ElementAt(i));
        }