Example #1
0
        public async Task <IActionResult> Edit(string id, [Bind("UserID,Movies")] MoviesList moviesList)
        {
            if (id != moviesList.UserID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(moviesList);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MoviesListExists(moviesList.UserID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(moviesList));
        }
        public MoviesList Update(MoviesList moviesList)
        {
            var entity = moviesDbContext.MoviesList.Attach(moviesList);

            entity.State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            return(moviesList);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            MoviesList moviesList = db.MoviesList.Find(id);

            db.MoviesList.Remove(moviesList);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
 private void InitRecyclerView()
 {
     MoviesList.AddItemDecoration(new MarginDecoration(this));
     MoviesList.HasFixedSize = true;
     //RecyclerView.SetLayoutManager(new GridLayoutManager(this, 4, GridLayoutManager.Vertical, false));
     _movieListAdapter = new MovieListAdapter(ViewModel.Movies, MoviesApplication.Container.Get <IScheduleProvider>());
     MoviesList.SetAdapter(_movieListAdapter);
 }
Example #5
0
 public void CreateMoviesList()
 {
     using (MoviesList list = (MoviesList)ModulesManager.Current.OpenModuleObjectDetail(new MoviesListObject(Session), false)) {
         MoviesListView moviesListView = MoviesListView.LastCreatedView;
         Assert.IsNotNull(moviesListView);
         Assert.IsNotNull(moviesListView.Module);
         Assert.AreEqual(list, moviesListView.Module);
     }
 }
Example #6
0
 public void DeleteMovieFormMoviesList_CheckIsSessionCommit()
 {
     using (MoviesList moviesList = (MoviesList)ModulesManager.Current.OpenModuleObjectDetail(new MoviesListObject(Session), false)) {
         moviesList.MoviesEdit.CurrentRecord = SessionHelper.GetObject <Movie>(Avatar, moviesList.MoviesEdit.VRObjectsEditObject.VideoRentObjects.Session);
         Assert.IsTrue(moviesList.MoviesEdit.DeleteCurrentRecord());
         Assert.IsNull(moviesList.MoviesEdit.CurrentRecord);
         Assert.IsFalse(moviesList.VRObjectsListObject.Dirty);
     }
 }
Example #7
0
        // This parameter list data brought from program class
        public void CinemaTicketApp(List <MovieSeatDetails> ListOfSeat)
        {
            CustomersList customers = new CustomersList();
            // This list is to get the stored user data from customers list
            List <CustomerDetails> ListOfCustomer = customers.ListOfCustomer();

            MoviesList movies = new MoviesList();
            // This list is to get the stored movie data from movies list
            List <MovieDetails> ListOfMovie = movies.ListOfMovies();

            bool menu = true;

            while (menu)
            {
                Console.WriteLine("Welcome to TGV Cinema Ticket App");
                Console.WriteLine("1. View all movies");
                Console.WriteLine("2. Login");
                Console.WriteLine("3. Exit app\n");

                Console.Write("Enter your option: ");
                var option = Console.ReadLine();

                switch (option)
                {
                case "1":
                    // Print the all cinema by using this method, ListOfMovie has the all movies stored inside.
                    PrintCinemaMovies(ListOfMovie);
                    Console.WriteLine("Login to buy a movie ticket of your favourite movie.");
                    Thread.Sleep(3000);
                    Console.Clear();
                    break;

                case "2":
                    Console.Clear();
                    Console.Write("Username : "******"\nPassword : "******"3":
                    Console.WriteLine("\nThanks for using. Have a nice day!\n");
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("\nInvalid Option\n");
                    Thread.Sleep(1000);
                    Console.Clear();
                    break;
                }
            }
        }
Example #8
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            foreach (var item in SearchList)
            {
                MoviesList.Remove(item);
            }

            SearchList.Clear();
        }
        /// <summary>
        /// Call Bl and get the movies list
        /// </summary>
        public IEnumerable <Movie> GetMoviesList()
        {
            BlTest     blTest   = new BlTest();
            MoviesList lsMovies = new MoviesList();

            lsMovies = blTest.GetMoviesList();

            return(lsMovies.Movies);
        }
Example #10
0
 public IActionResult OnGet(int movieID)
 {
     MoviesList = _moviesData.GetMovieById(movieID);
     if (MoviesList == null)
     {
         return(RedirectToPage("./Error"));
     }
     return(Page());
 }
        public IActionResult OnGet(int movieId)
        {
            Movies = moviesData.GetMovieById(movieId);
            if (Movies == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            return(Page());
        }
Example #12
0
        public async Task <IActionResult> Create([Bind("UserID,Movies")] MoviesList moviesList)
        {
            if (ModelState.IsValid)
            {
                _context.Add(moviesList);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(moviesList));
        }
 private void RemoveMovie(string title)
 {
     for (int i = 0; i < MoviesList.Count; i++)
     {
         if (MoviesList[i].Title.Equals(title))
         {
             MoviesList.RemoveAt(i);
             break;
         }
     }
 }
        public MoviesList Update(MoviesList moviesList)
        {
            var movie = moviesLists.SingleOrDefault(s => s.Id == moviesList.Id);

            if (movie != null)
            {
                movie.MovieName = moviesList.MovieName;
                movie.Country   = moviesList.Country;
                movie.Genres    = moviesList.Genres;
            }
            return(movie);
        }
        public IActionResult OnPost(int movieId)
        {
            Movies = moviesData.Delete(movieId);
            moviesData.Commit();
            if (Movies == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            TempData["Message"] = "Deleted Successfully";
            return(RedirectToPage("./List"));
        }
        // GET: MoviesList/Sync
        public async Task <ActionResult> Sync(int id, MovieDetails MovieDetails)
        {
            MoviesList movieList = db.MoviesList.Find(id);

            OmdbApi omdbApi = await service.GetMovieDetailsFromApi(movieList.MovieName);

            if (omdbApi.IMDBId != null)
            {
                ProcessMovieData(omdbApi, id);
            }

            return(RedirectToAction("Index"));
        }
Example #17
0
 private void MenuItem_Add(object sender, RoutedEventArgs e)
 {
     for (int i = 0; i < 100000; i++)
     {
         MoviesList.Add(new Movie()
         {
             Title    = "Rubber",
             Director = "Quentin Dupieux",
             Rating   = Rating.Awesome,
             Type     = Type.Horror
         });
     }
 }
Example #18
0
        public void TryDeleteDenyObject_CheckInfoMessage()
        {
            Assert.IsNotNull(Anton.DoRent(new RentInfo(Avatar, MovieItemFormat.DVD)));
            SessionHelper.CommitSession(Session, null);
            Assert.IsFalse(Avatar.AllowDelete);
            MoviesList moviesList = (MoviesList)ModulesManager.Current.OpenModuleObjectDetail(new MoviesListObject(Session), false);

            moviesList.MoviesEdit.CurrentRecord = SessionHelper.GetObject <Movie>(Avatar, moviesList.MoviesEdit.VRObjectsEditObject.VideoRentObjects.Session);
            TestMessageBoxView.ShowDelegate     = MessageBoxShow;
            Assert.IsFalse(moviesList.MoviesEdit.DeleteCurrentRecord());
            Assert.AreEqual(ConstStrings.Get("ObjectCanNotBeDeleted"), message);
            TestMessageBoxView.ShowDelegate = null;
            moviesList.Dispose();
        }
        // GET: MoviesList/Delete
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MoviesList moviesList = db.MoviesList.Find(id);

            if (moviesList == null)
            {
                return(HttpNotFound());
            }
            return(View(moviesList));
        }
Example #20
0
        public async Task <IHttpActionResult> DeleteMoviesList(long id)
        {
            MoviesList moviesList = await db.MoviesLists.FindAsync(id);

            if (moviesList == null)
            {
                return(NotFound());
            }

            db.MoviesLists.Remove(moviesList);
            await db.SaveChangesAsync();

            return(Ok(moviesList));
        }
        public async Task <IActionResult> Index()
        {
            var moviesFrmDb = await _context.Movies.ToListAsync();

            var moviesList = new List <MoviesList>();

            foreach (var val in moviesFrmDb)
            {
                var movies = new MoviesList();
                movies.Name        = val.Name;
                movies.Id          = val.Id;
                movies.ReleaseYear = val.ReleaseDate.Year;
                moviesList.Add(movies);
            }
            return(View(moviesList));
        }
Example #22
0
        private void MenuItem_Export(object sender, RoutedEventArgs e)
        {
            XmlSerializer  SerializerObj  = new XmlSerializer(MoviesList.GetType());
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.DefaultExt = ".xml";
            saveFileDialog.Filter     = "XML documents (.xml) |*.xml";

            Nullable <bool> result = saveFileDialog.ShowDialog();

            if (result == true)
            {
                var          path = saveFileDialog.FileName;
                StreamWriter wr   = new StreamWriter(path);
                SerializerObj.Serialize(wr, MoviesList);
            }
        }
        public IActionResult OnGet(int?movieId)
        {
            if (movieId.HasValue)
            {
                Movies = movieList.GetMovieById(movieId.Value);
            }
            else
            {
                Movies = new MoviesList();
            }

            if (Movies == null)
            {
                return(RedirectToPage("./Error"));
            }
            Genres = htmlHelper.GetEnumSelectList <Genres>();
            return(Page());
        }
Example #24
0
        // Inserts data to MovieList table
        private void AddToMovieList(int Hdid, int Typeid, List <KeyValuePair <string, string> > Kvplist)
        {
            int countall    = Kvplist.Count();
            int countinsert = 0;
            int countupdate = 0;

            foreach (KeyValuePair <string, string> kvp in Kvplist)
            {
                string MovieName = kvp.Key;

                MoviesList moviesList = db.MoviesList.Where(m => m.MovieName.Equals(MovieName)).FirstOrDefault();
                bool       exits      = true;

                if (moviesList == null)
                {
                    exits      = false;
                    moviesList = new MoviesList();
                }

                moviesList.HDId      = Hdid;
                moviesList.TypeId    = Typeid;
                moviesList.MovieName = MovieName;
                moviesList.Path      = kvp.Value;

                if (exits)
                {
                    countupdate += 1;
                    db.Entry(moviesList).State = EntityState.Modified;
                }
                else
                {
                    countinsert += 1;
                    db.MoviesList.Add(moviesList);
                }

                db.SaveChanges();
            }
            int countremain = countall - (countinsert + countupdate);
        }
Example #25
0
        private void MenuItem_Import(object sender, RoutedEventArgs e)
        {
            XmlSerializer  SerializerObj  = new XmlSerializer(MoviesList.GetType());
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.DefaultExt = ".xml";
            openFileDialog.Filter     = "XML documents (.xml) |*.xml";

            Nullable <bool> result = openFileDialog.ShowDialog();

            if (result == true)
            {
                var          path = openFileDialog.FileName;
                StreamReader rd   = new StreamReader(path);
                ObservableCollection <Movie> list = new ObservableCollection <Movie>();

                list = (ObservableCollection <Movie>)SerializerObj.Deserialize(rd);
                foreach (Movie item in list)
                {
                    MoviesList.Add(item);
                }
            }
        }
Example #26
0
        public async Task Init()
        {
            string route = "now-showing";
            var    list  = await _moviesApi.Get <List <MovieDto> >(null, route);

            MoviesList.Clear();

            foreach (var movie in list)
            {
                MoviesList.Add(movie);
            }


            var userId = await _moviesApi.GetCurrentUserId();

            var listRecommended = await _moviesApi.Get <List <MovieDto> >(userId, "recommended");

            MoviesRecommendedList.Clear();

            foreach (var movie in listRecommended)
            {
                MoviesRecommendedList.Add(movie);
            }
        }
Example #27
0
 public MoviesListView(MoviesList moviesList)
     : base(moviesList)
 {
     LastCreatedView = this;
 }
 private void AddMovie(Movie movie)
 {
     MoviesList.Add(movie);
 }
 private void RemoveMovie(Movie movie)
 {
     MoviesList.Remove(movie);
 }
 void SetCollectionViewItemTemplate()
 {
     MoviesList.ItemTemplate = new SelectedFavoriteMovieTemplateSelector();
     MoviesList.Bind(CollectionView.ItemsSourceProperty, nameof(FavoriteMoviesPageViewModel.FavMoviesList));
 }