Beispiel #1
0
        public void EditCinema(int cinemaId, CinemaView cinema)
        {
            var editCinema = _db.Cinemas.Find(cinemaId);

            editCinema.Title = cinema.Title;
            editCinema.City  = cinema.City;

            _db.SaveChanges();
        }
Beispiel #2
0
        private void SetCinemaView(CinemaView newCinemaView)
        {
            if (this.currentCinemaView == newCinemaView)
            {
                return;
            }

            this.currentCinemaView = newCinemaView;

            if (currentCinemaView == CinemaView.ShowByDate)
            {
                this.SetFilmsForSelectedDate((DateTime)this.dpShowing.Value);

                this.semanticZoomShowByDate.Visibility = Windows.UI.Xaml.Visibility.Visible;
                this.semanticZoomFilmList.Visibility   = Windows.UI.Xaml.Visibility.Collapsed;

                return;
            }

            List <GroupInfoList <object> > filmDataSet = null;

            switch (this.currentCinemaView)
            {
            case CinemaView.Current:
                filmDataSet = fdViewViewByDate.CurrentFilmGroups;
                break;

            case CinemaView.Upcoming:
                filmDataSet = fdViewViewByDate.UpcomingFilmGroups;
                break;
            }

            this.semanticZoomShowByDate.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            this.semanticZoomFilmList.Visibility   = Windows.UI.Xaml.Visibility.Visible;

            if (filmDataSet != null)
            {
                FilmsForSelectedDate.Clear();

                foreach (var entry in filmDataSet)
                {
                    FilmsForSelectedDate.Add(entry);
                }

                (this.semanticZoomFilmList.ZoomedOutView as ListViewBase).ItemsSource = fdViewViewByDate.GetFilmHeaders(filmDataSet);

                (this.semanticZoomFilmList.ZoomedOutView as ListViewBase).UpdateLayout();

                GroupInfoList <object> group = filmDataSet.Find(g => g.Count > 0);

                if (group != null)
                {
                    (this.semanticZoomFilmList.ZoomedInView as ListViewBase).ScrollIntoView(group);
                }
            }
        }
Beispiel #3
0
        public int CreateCinema(CinemaView cinema)
        {
            var newCinema = new Cinema
            {
                Title = cinema.Title,
                City  = cinema.City
            };

            _db.Cinemas.Add(newCinema);
            _db.SaveChanges();

            return(newCinema.Id);
        }
Beispiel #4
0
        private void LoadFilmList(List <FilmInfo> films)
        {
            this.currentCinemaView = CinemaView.ShowByDate;

            fdViewViewByDate = new FilmData(films);

            cvsShowByDate.Source = FilmsForSelectedDate;

            this.SetFilmsForSelectedDate(DateTime.Today);

            //(semanticZoomShowByDate.ZoomedOutView as ListViewBase).ItemsSource = fdViewViewByDate.GetFilmHeaders(dataLetter);

            semanticZoomShowByDate.ViewChangeStarted -= semanticZoom_ViewChangeStarted;
            semanticZoomShowByDate.ViewChangeStarted += semanticZoom_ViewChangeStarted;
        }
        public IActionResult EditCinema([FromBody] CinemaView cinema, int cinemaId)
        {
            if (!_сinemaService.CheckCinemaExists(cinemaId))
            {
                return(NotFound(new Response(ErrorOfCinemaNonexistence)));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(new Response(ModelState)));
            }

            _сinemaService.EditCinema(cinemaId, cinema);

            return(Ok(new Response()));
        }
        public IActionResult CreateCinema([FromBody] CinemaView cinema)
        {
            if (_сinemaService.CheckCinemaExists(cinema))
            {
                return(BadRequest(new Response(ErrorOfCinemaExistence)));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(new Response(ModelState)));
            }

            int id = _сinemaService.CreateCinema(cinema);

            var response = new CreateResponse(id);

            return(CreatedAtAction(nameof(GetCinema), new { id = response.Id }, response));
        }
Beispiel #7
0
 public bool CheckCinemaExists(CinemaView cinema)
 {
     return(_db.Cinemas.Any(c => (c.Title == cinema.Title && c.City == cinema.City && !c.IsDeleted)));
 }