Esempio n. 1
0
        public async Task <IActionResult> Index()
        {
            IndexVM listOfGenresSubGenresAndMovies = new IndexVM
            {
                GenreList    = await _genreRepo.GetAllAsync(SD.GenreAPIPath, HttpContext.Session.GetString("JWToken")),
                SubGenreList = await _subGenreRepo.GetAllAsync(SD.SubGenreAPIPath, HttpContext.Session.GetString("JWToken")),
                MovieList    = await _movieRepo.GetAllAsync(SD.MovieAPIPath, HttpContext.Session.GetString("JWToken"))
            };

            return(View(listOfGenresSubGenresAndMovies));
        }
Esempio n. 2
0
        public async Task <IActionResult> Upsert(Guid?id)
        {
            MovieUpsertVM obj = new MovieUpsertVM()
            {
                GenreList    = await _genreRepo.GetAllAsync(SD.GenreAPIPath, HttpContext.Session.GetString("JWToken")),
                SubGenreList = await _subGenreRepo.GetAllAsync(SD.SubGenreAPIPath, HttpContext.Session.GetString("JWToken")),
                Movies       = new MoviesModel()
            };


            if (id == null)
            {
                // this would be true for insert or create
                return(View(obj));
            }
            // flow will come for update
            obj.Movies = await _movieRepo.GetAsync(SD.MovieAPIPath, id.GetValueOrDefault(), HttpContext.Session.GetString("JWToken"));

            if (obj.Movies == null)
            {
                return(NotFound());
            }
            return(View(obj));
        }
Esempio n. 3
0
 public async Task <IActionResult> GetAllSubGenre()
 {
     return(Json(new { data = await _subGenreRepo.GetAllAsync(SD.SubGenreAPIPath, HttpContext.Session.GetString("JWToken")) }));
 }