Beispiel #1
0
 public ActionResult GetCinemaDropdown()
 {
     if (Session["Cinema"] == null)
     {
         Session["Cinema"] = cinemaService.GetCinema(1);
     }
     ViewBag.Cinema = cinemaService.GetAll();
     return(PartialView("_Navigation", ViewBag.Cinema));
 }
Beispiel #2
0
        public ActionResult Details(int id)
        {
            var result = Authenticate();

            if (result == 1)
            {
                Cinema cinema = cinemaService.GetCinema(id);
                if (cinema == null)
                {
                    return(HttpNotFound());
                }
                return(View(cinema));
            }
            else
            {
                return(View("Error404"));
            }
        }
Beispiel #3
0
        private void CinemasList_SelectedIndexChanged(object sender, EventArgs e)
        {
            Cinema cinema = CinemaService.GetCinema(this.CinemasList.SelectedItem.ToString(),
                                                    this.TownsList.SelectedItem.ToString());
            CinemaEditForm cinemaeditForm = new CinemaEditForm(cinema);

            cinemaeditForm.TopLevel   = false;
            cinemaeditForm.AutoScroll = true;
            this.Hide();
            ((ComboBox)sender).Parent.Parent.Controls.Add(cinemaeditForm);
            cinemaeditForm.Show();
        }
Beispiel #4
0
        public void GetCinemaTest_return_cinema_if_provided_correct_id()
        {
            //given
            var loadMoviesService = new LoadDataService();
            var sut = new CinemaService(loadMoviesService);

            //when
            var result = sut.GetCinema(3);

            //then
            Assert.IsNotNull(result);
        }
Beispiel #5
0
        public void GetCinemaByIdTest_returns_null_if_provided_incorrect_id()
        {
            //given
            int id     = 40;
            var movies = new List <Movie> {
                new Movie {
                    Id = 4, Title = "Title", Price = 1
                }
            };

            _moqLoadDataSvc.Setup(m => m.GetMovies(It.IsAny <string>())).Returns(movies);
            var sut = new CinemaService(_moqLoadDataSvc.Object);

            //when
            var result = sut.GetCinema(id);

            //then
            Assert.IsNull(result);
        }