public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. // If not required for your application you can safely delete this method this.Window = new UIWindow(UIScreen.MainScreen.Bounds); ImageDownloader imageDownloader = new ImageDownloader(new StorageClient()); MovieConverter converter = new MovieConverter(new MovieDbSettings()); var searchController = new MovieSearchViewController(converter, imageDownloader); UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(24, 24, 24); UINavigationBar.Appearance.TintColor = UIColor.FromRGB(186, 157, 9); UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes() { TextColor = UIColor.White }); var searchNavigationController = new UINavigationController(searchController); var topRatedController = new TopRatedController(converter); var topRatedNavigationController = new UINavigationController(topRatedController); var tabBarController = new TabBarController() { ViewControllers = new UIViewController[] { searchNavigationController, topRatedNavigationController } }; this.Window.RootViewController = tabBarController; this.Window.MakeKeyAndVisible(); return(true); }
public void ShouldConvertMovieToMovieDB() { var movie = new Movie { Title = "The Movie", Description = "Some Description", Category = Category.Action, Classification = Classification.PG, Format = Format.DVD, ReleaseYear = "1999", RunningTime = TimeSpan.FromMinutes(123), DateAdded = new DateTime(2015, 01, 01), CoverPhoto = "TheMovie.bmp", TVRecording = true, Id = 1 }; var converter = new MovieConverter(); var movieDB = converter.ConvertToMovieDB(movie); Assert.Equal(movie.Title, movieDB.Title); Assert.Equal(movie.Description, movieDB.Description); Assert.Equal(movie.Category.ToString(), movieDB.Category); Assert.Equal(movie.Classification.ToString(), movieDB.Classification); Assert.Equal(movie.Format.ToString(), movieDB.Format); Assert.Equal(movie.ReleaseYear, movieDB.ReleaseYear); Assert.Equal(movie.RunningTime.TotalMinutes, movieDB.RunningTime); Assert.Equal(movie.DateAdded, movieDB.DateAdded); Assert.Equal(movie.CoverPhoto, movieDB.CoverPhoto); Assert.Equal(movie.TVRecording, movieDB.TVRecording); Assert.Equal(movie.Id, movieDB.Id); }
public void ShouldConvertMovieDBToMovie() { var movieDB = new MovieDB { Title = "The Movie", Description = "Some Description", Category = "Action", Classification = "PG", Format = "DVD", ReleaseYear = "1999", RunningTime = 123, DateAdded = new DateTime(2015, 01, 01), CoverPhoto = "TheMovie.bmp", TVRecording = true, Id = 1 }; var converter = new MovieConverter(); var movie = converter.ConvertToMovie(movieDB); Assert.Equal(movieDB.Title, movie.Title); Assert.Equal(movieDB.Description, movie.Description); Assert.Equal(movieDB.Category, movie.Category.ToString()); Assert.Equal(movieDB.Classification, movie.Classification.ToString()); Assert.Equal(movieDB.Format, movie.Format.ToString()); Assert.Equal(movieDB.ReleaseYear, movie.ReleaseYear); Assert.Equal(movieDB.RunningTime, movie.RunningTime.TotalMinutes); Assert.Equal(movieDB.DateAdded, movie.DateAdded); Assert.Equal(movieDB.CoverPhoto, movie.CoverPhoto); Assert.Equal(movieDB.TVRecording, movie.TVRecording); Assert.Equal(movieDB.Id, movie.Id); }
public async Task <MovieViewModel> GetMovieByIDAsync(int ID, CancellationToken ct = default(CancellationToken)) { MovieViewModel movieViewModel = MovieConverter.Convert(await _movieRepository.GetByIDAsync(ID, ct)); movieViewModel.Favorites = await GetAllFavoritesByMovieIDAsync(movieViewModel.MovieID, ct); return(movieViewModel); }
public MovieDTO Movie(int id) { MovieDTO item = new MovieConverter().Convert( facade.GetMovieRepo().Get(id)); if (item == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return item; }
public List <Movie> getMoviesToWatch() { List <Movie> movies = new List <Movie>(); foreach (EF.Model.Movie movie in context.Movies.Where(m => m.isWatched == false)) { movies.Add(MovieConverter.convertFromDTO(movie)); } return(movies); }
public string PostMovie(MovieForJson movieForJson) { try { Movie movie = MovieConverter.ConvertJsonMovieToMovie(movieForJson); movieDBContext.Movies.Add(movie); movieDBContext.SaveChanges(); return(JsonConvert.SerializeObject(movie)); } catch (Exception e) { return(JsonConvert.SerializeObject("Wrong data")); } }
/// <summary> /// Will get a specific Movie found by the Id /// </summary> /// <param name="id"></param> /// <returns></returns> public HttpResponseMessage Get(int id) { var movie = new Facade().GetMovieRepository().Get(id); MovieDto movieDto = null; if (movie != null) { movieDto = new MovieConverter().Convert(movie); return Request.CreateResponse<MovieDto>(HttpStatusCode.OK, movieDto); } var response = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent(" Movie not found.") }; throw new HttpResponseException(response); }
public static void Main() { var context = new MovieAppDBContext(); if (!context.Movies.Any()) { string moviesPath = @"..\..\..\SquidsMovieApp.Data\Utilities\JsonData\movies.json"; var parser = new Parser(); var webConverter = new WebConverter(); var movies = parser.ParseMovies(moviesPath); var converter = new MovieConverter(context, webConverter, parser); converter.AddOrUpdateMovies(movies); } }
public IActionResult ViewSearchedMovie(int Id) { // This displays a closer look at an individual movie when it is selected. Movie searchedMovie = GetTMDbMovieInfo(Id); if (searchedMovie != null) { MovieConverter movieConverter = new MovieConverter(); Film film = movieConverter.ConvertToFilm(searchedMovie, _context.Genres.ToList()); ViewMovieViewModel vm = new ViewMovieViewModel(film, film.FilmGenres); return(View(vm)); } return(RedirectToAction("Index")); }
/// <summary> /// Creates a Movie in the Database /// </summary> /// <param name="movie"></param> /// <returns></returns> public HttpResponseMessage Post(MovieDto movieDto) { try { var movie = new MovieConverter().Convert(movieDto); facade.GetMovieRepository().Add(movie); var response = Request.CreateResponse<MovieDto>(HttpStatusCode.Created, movieDto); var uri = Url.Link("GetMovieById", new { movie.Id }); response.Headers.Location = new Uri(uri); return response; } catch (Exception) { var response = new HttpResponseMessage(HttpStatusCode.Conflict) { Content = new StringContent("Could not add a Movie to the database") }; throw new HttpResponseException(response); } }
public MovieSearchViewController(MovieConverter converter, ImageDownloader imageDownloader) { this.TabBarItem = new UITabBarItem(UITabBarSystemItem.Search, 0); this.converter = converter; this.imageDownloader = imageDownloader; }
public MovieOrchestrator(IOMDBConnector OMDBConnector, MovieMapper movieMapper, MovieConverter movieConverter) { _OMDBConnector = OMDBConnector; _movieMapper = movieMapper; _movieConverter = movieConverter; }
/// <summary> /// Updates a Movie in Database /// </summary> /// <param name="movie"></param> /// <returns></returns> public HttpResponseMessage Put(MovieDto movieDto) { try { Movie movie = new MovieConverter().Convert(movieDto); facade.GetMovieRepository().Edit(movie); var response = Request.CreateResponse<MovieDto>(HttpStatusCode.OK, movieDto); var uri = Url.Link("GetMovieById", new { movie.Id }); response.Headers.Location = new Uri(uri); return response; } catch (Exception) { var response = new HttpResponseMessage(HttpStatusCode.Conflict) { Content = new StringContent("No matching customer") }; throw new HttpResponseException(response); } }