Exemple #1
0
 private bool FilmInfoValid(FilmInfo filmInfo)
 {
     return(!String.IsNullOrEmpty(filmInfo.Name) &&
            !String.IsNullOrEmpty(filmInfo.Description) &&
            filmInfo.StartDate < filmInfo.EndDate &&
            filmInfo.Duration != 0);
 }
        private void FilmListing_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FilmInfo newFI = null;

            if (sender is Image)
            {
                Image img = sender as Image;

                newFI = img.Tag as FilmInfo;
            }
            else if (sender is Grid)
            {
                Grid grid = sender as Grid;

                newFI = grid.Tag as FilmInfo;
            }
            else
            {
                return;
            }

            if (newFI == null)
            {
                return;
            }

            List <FilmInfo> films = App.CinemaFilms[SelectedCinema.ID];

            ShowPerformances.SelectedFilm      = films.First(f => f.EDI == newFI.EDI);
            ShowPerformances.SelectedCinema    = SelectedCinema;
            ShowPerformances.ShowCinemaDetails = false;
            ShowPerformances.ShowFilmDetails   = true;
            NavigationService.Navigate(new Uri("/ShowPerformances.xaml", UriKind.Relative));
        }
        public ActionResult Create(FilmInfo film)
        {
            Genre           genre = _db.GetAllGenres().FirstOrDefault(x => x.Id == film.GenreId);
            ApplicationUser user  = UserManager.FindById(User.Identity.GetUserId());

            if (genre != null)
            {
                film.User           = user.UserName;
                film.Email          = user.Email;
                film.Genre          = genre;
                film.PosterFilePAth = "/posterPicStore/" + film.PosterFilePAth;
                if (film.PosterFilePAth == "/posterPicStore/")
                {
                    film.PosterFilePAth = "/posterPicStore/default.jpg";
                }

                if (ModelState.IsValid)
                {
                    if (user.Email != "")
                    {
                        _db.CreateCard(film);
                        return(RedirectToAction("Index"));
                    }
                }
            }
            ViewBag.Message = "Введите информацию о фильме";
            ViewBag.Title   = "Создание карточки фильма.";
            SelectList items = new SelectList(_db.GetAllGenres(), "Id", "Name");

            ViewBag.Genres = items;
            FilmInfo newFilmInfoCard = new FilmInfo();

            newFilmInfoCard.Id = _db.GetMaxCardId();
            return(View(newFilmInfoCard));
        }
Exemple #4
0
        private void lbInfo_Click(object sender, EventArgs e)
        {
            if (lbInfo.SelectedIndex == -1)
            {
                return;
            }
            LogUnit  logUnit  = (LogUnit)updateService.GetLog()[lbInfo.SelectedIndex];
            Film     film     = logUnit.film;
            FilmInfo filmInfo = logUnit.filmInfo;

            tbRussianTitle.Text  = film.russianTitle;
            tbOriginalTitle.Text = film.originalTitle;
            tbYear.Text          = film.year;
            tbCountry.Text       = film.country;
            tbGenre.Text         = film.genre;
            tbDirector.Text      = film.director;
            rtbActors.Text       = film.actors;
            tbWorldDate.Text     = film.worldDate;
            tbRussianDate.Text   = film.russianDate;
            tbDiscDate.Text      = film.discDate;
            tbRusTitle.Text      = filmInfo.russianTitle;
            tbOrigTitle.Text     = filmInfo.originalTitle;
            tbY.Text             = filmInfo.year;
            tbC.Text             = filmInfo.country;
            tbG.Text             = filmInfo.genre;
            tbD.Text             = filmInfo.director;
            rtbA.Text            = filmInfo.actors;
            tbWDate.Text         = filmInfo.worldPremiere;
            tbRDate.Text         = filmInfo.russianPremiere;
            tbDDate.Text         = filmInfo.discPremiere;
        }
        public override async Task GetCinemaFilmListings(int cinemaID, bool bForce = false)
        {
            string FileName = String.Format(FilmsPerCinemaFileName, cinemaID);
            
            await base.GetCinemaFilmListings(cinemaID, bForce);

            List<FilmHeader> filmheaders = await DeserialiseObject<List<FilmHeader>>(FileName);
            List<FilmInfo> films = new List<FilmInfo>();
            foreach (var fh in filmheaders)
            {
                FilmInfo fi = null;

                if (App.Films.TryGetValue(fh.EDI, out fi))
                {
                    FilmInfo newfi = fi.Clone();

                    if (newfi != null)
                        newfi.Performances = fh.Performances;

                    foreach (var p in newfi.Performances)
                        p.FilmTitle = newfi.Title;

                    films.Add(newfi);
                }
            }
            App.CinemaFilms[cinemaID] = films;
        }
Exemple #6
0
 public string Post([FromBody] FilmInfo value)
 {
     if (!cinemaContext.FilmInfo.Any(film => film.Name.Equals(value.Name)))
     {
         FilmInfo film = new FilmInfo();
         film.Name        = value.Name;
         film.Year        = value.Year;
         film.Country     = value.Country;
         film.Duration    = value.Duration;
         film.Genre       = value.Genre;
         film.Description = value.Description;
         film.Poster      = value.Poster;
         film.Id          = Guid.NewGuid();
         try
         {
             cinemaContext.Add(film);
             cinemaContext.SaveChanges();
             return(JsonConvert.SerializeObject("Фильм успешно добавлен"));
         }
         catch (Exception ex)
         {
             return(JsonConvert.SerializeObject(ex.Message));
         }
     }
     else
     {
         return(JsonConvert.SerializeObject("Такой фильм уже добавлен!"));
     }
 }
        public FilmInfo GetIndividualFilm(int filmID)
        {
            Film film = DB.Films.First(f => f.ID == filmID);

            var showtimes = DB.Showtimes
                            .Where(showtime => showtime.FilmID == filmID)
                            .ToList();

            var seatsForAllShowtimes = DB.Showtimes
                                       .Where(showtime => showtime.FilmID == filmID)
                                       .Select(s => s.Seats);

            var returnFilm = new FilmInfo {
                BriefSummary    = film.BriefSummary,
                Country         = film.Country,
                Director        = film.Director,
                FullDescription = film.FullDescription,
                ID           = film.ID,
                InfoImgPath  = film.InfoImgPath,
                Runtime      = film.Runtime,
                Title        = film.Title,
                YearReleased = film.YearReleased,
                Showtimes    = showtimes,
            };

            return(returnFilm);
        }
        public void InsertFilm(FilmInfo item)
        {
            var     dt      = MtimeHelper.Query("select * from FilmInfo where 1!=1").Tables[0];
            var     dateNow = DateTime.Now;
            DataRow dr      = dt.NewRow();

            dr["FilmName"]         = item.FilmName.Transferred();
            dr["FilmTypes"]        = item.FilmTypes.Transferred();
            dr["FilmLenth"]        = item.FilmLenth;
            dr["FilmDirector"]     = item.FilmDirector.Transferred();
            dr["FilmActor"]        = item.FilmActor.Transferred();
            dr["FilmBrief"]        = item.FilmBrief.Transferred();
            dr["FilmYear"]         = item.FilmYear;
            dr["FilmOtherName"]    = item.FilmOtherName.Transferred();
            dr["CreateDate"]       = DateTime.Now;
            dr["FilmCountry"]      = item.FilmCountry.Transferred();
            dr["FilmScreenwriter"] = item.FilmScreenwriter.Transferred();
            dr["Mtime_FilmID"]     = item.Mtime_FilmID;
            dr["FilmPic"]          = item.FilmPic.Transferred();
            dr["ShangYing"]        = item.ShangYing;
            dr["ZhiShi"]           = item.ZhiShi.Transferred();
            dr["FilmHref"]         = item.FilmHref.TrimStr();
            dt.Rows.Add(dr);
            MtimeHelper.BulkToDB("FilmInfo", dt);
        }
        async void miSave_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                ContextMenu cm = mi.Parent as ContextMenu;

                FilmInfo fi = (FilmInfo)cm.Tag;

                string original = fi.MediumPosterUrl.OriginalString.Replace("w500", "original");

                using (MemoryStream stream = new MemoryStream())
                {
                    await new AsyncWebClient().SavePictureLocally(original, stream);

                    stream.Position = 0;

                    string filename = Path.GetFileName(original);

                    mediaLib.SavePicture(filename, stream);
                }

                //StorageFolder folder = KnownFolders.SavedPictures;
                //StorageFile file = await folder.CreateFileAsync(String.Format("{0}.jpg", fi.Title), CreationCollisionOption.ReplaceExisting);
                //using (Stream s = await file.OpenStreamForWriteAsync())
                //{
                //    s.Write(data, 0, data.Length);
                //}
            }
        }
        void miAllow_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                ContextMenu cm = mi.Parent as ContextMenu;

                FilmInfo fi = (FilmInfo)cm.Tag;

                IEnumerable <FilmInfo> filmsToIgnore = App.Films.Values.Where(f => f.MediumPosterUrl != null && String.Compare(fi.MediumPosterUrl.OriginalString, f.MediumPosterUrl.OriginalString, StringComparison.OrdinalIgnoreCase) == 0);

                if (filmsToIgnore != null)
                {
                    List <int> films = new List <int>(Config.FilmPostersToIgnore);
                    foreach (var film in filmsToIgnore)
                    {
                        films.Remove(film.EDI);
                    }

                    Config.FilmPostersToIgnore = films;
                }

                this.LoadPosters();
            }
        }
Exemple #11
0
        public Result EditFilm(int filmId, FilmInfo filmInfo)
        {
            if (!FilmExists(filmId))
            {
                return(new Result
                {
                    ResultOk = false,
                    Details = "Such film does not exist."
                });
            }

            if (!FilmInfoValid(filmInfo))
            {
                return(new Result
                {
                    ResultOk = false,
                    Details = "Invalid film data."
                });
            }

            Film film = dbContext.Films.FirstOrDefault(f => f.FilmId == filmId);

            film.Name        = filmInfo.Name;
            film.StartDate   = filmInfo.StartDate;
            film.EndDate     = filmInfo.EndDate;
            film.Duration    = filmInfo.Duration;
            film.Description = filmInfo.Description;

            dbContext.SaveChanges();

            return(new Result
            {
                ResultOk = true
            });
        }
        //private void SpinAndWait(bool bNewVal)
        //{
        //    this.gBody.Visibility = bNewVal ? Windows.UI.Xaml.Visibility.Collapsed : Windows.UI.Xaml.Visibility.Visible;
        //    this.gProgress.Visibility = bNewVal ? Windows.UI.Xaml.Visibility.Visible : Windows.UI.Xaml.Visibility.Collapsed;
        //    this.prProgress.IsActive = bNewVal;
        //}

        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            DataTransferManager.GetForCurrentView().DataRequested += FilmDetails_DataRequested;

            this.AllowSearch(false);

            PlayToManager.GetForCurrentView().SourceRequested += PlayToManagerOnSourceRequested;

            if (!bLoaded)
            {
                SelectedFilm = e.Parameter as FilmInfo; //App.Films[iFilm];

                this.piPoster.Source = new BitmapImage(SelectedFilm.PosterImage);

                if (!Config.ShowCleanBackground)
                {
                    if (SelectedFilm.BackdropUrl != null)
                    {
                        this.LayoutRoot.Background = new ImageBrush()
                        {
                            ImageSource = new BitmapImage(SelectedFilm.BackdropUrl),
                            Opacity     = 0.2,
                            Stretch     = Stretch.UniformToFill
                        };
                    }
                    else
                    {
                        string uri = (SelectedFilm.PosterImage.AbsoluteUri);
                        if (uri.Contains("w500"))
                        {
                            uri = uri.Replace("w500", "original");
                            this.gBody.Background = new ImageBrush()
                            {
                                ImageSource = new BitmapImage(new Uri(uri)),
                                Opacity     = 0.2,
                                Stretch     = Stretch.UniformToFill
                            };
                        }
                    }
                }

                try
                {
                    await LoadFilmDetails();

                    this.dtHideAppBar.Interval    = TimeSpan.FromSeconds(10);
                    this.dtHideAppBar.Tick       += dtHideAppBar_Tick;
                    this.filmDetailsAppBar.IsOpen = true;
                    this.dtHideAppBar.Start();
                }
                catch
                {
                }

                bLoaded = true;
            }
        }
Exemple #13
0
        public static FilmInfo GetFromTitle(string title, int index)
        {
            FilmInfo ans        = new FilmInfo();
            string   hexedTitle = TitleManipulator.HexIt(title);

            ans.HexedTitle = hexedTitle;
            ans.Key        = title;


            ans.titre      = currMovie.Title;
            ans.orig_titre = currMovie.OriginalTitle;
            ans.year       = currMovie.ProductionYear.ToString();
            if (currMovie.CastingShort != null)
            {
                ans.realisateur = currMovie.CastingShort.Directors;
            }

            if (currMovie.Statistics != null && currMovie.Statistics.PressRating != null)
            {
                ans.presse = (double)currMovie.Statistics.PressRating;
            }

            ans.totalInSearch = currCount;
            if (currMovie.LinkList != null && currMovie.LinkList.Count > 0)
            {
                ans.link = currMovie.LinkList[0].Href;
            }

            if (currMovie.Runtime != null)
            {
                ans.duree = TimeSpan.FromSeconds(int.Parse(currMovie.Runtime)).ToString();
            }

            ans.genre = "";
            if (currMovie.GenreList != null)
            {
                foreach (var genre in currMovie.GenreList)
                {
                    ans.genre += genre.Value + ", ";
                }
                ans.genre = ans.genre.TrimEnd(' ');
                ans.genre = ans.genre.TrimEnd(',');
            }
            if (currMovie.SynopsisShort != null)
            {
                ans.synopsis = currMovie.SynopsisShort.Replace("<br />", "\n").Replace("<br/>", "\n");
                ans.synopsis = noHTMLreg.Replace(ans.synopsis, "");
            }

            if (currMovie.Poster != null)
            {
                ans.jaquette     = BitmapFromWeb(currMovie.Poster.Href);
                ans.jaquetteTime = DateTime.Now;
            }

            return(ans);
        }
Exemple #14
0
        public IActionResult Delete(int id)
        {
            //x = each individual FilmInfo where x has x.FilmID == id
            FilmInfo itemRemove = _context.FilmInfo.Where(x => x.FilmID == id).FirstOrDefault();

            _context.FilmInfo.Remove(itemRemove);
            _context.SaveChanges();
            return(RedirectToAction("Confirmation"));
        }
Exemple #15
0
 public IActionResult EnterMovie(FilmInfo filmInput)
 {
     if (ModelState.IsValid)
     {
         _context.FilmInfo.Add(filmInput);
         _context.SaveChanges();
         return(View("Confirmation"));
     }
     return(View(filmInput));
 }
Exemple #16
0
        public IActionResult EditFilm([FromBody] FilmInfo filmInfo, int filmId)
        {
            Result result = filmService.EditFilm(filmId, filmInfo);

            if (result.ResultOk)
            {
                return(Ok());
            }
            return(NotFound(result));
        }
Exemple #17
0
        public IActionResult CreateFilm([FromBody] FilmInfo filmInfo)
        {
            ResultCreated result = filmService.CreateFilm(filmInfo);

            if (result.ResultOk)
            {
                return(Created($"api/films/{result.Id}", typeof(Film)));
            }
            return(BadRequest(result));
        }
Exemple #18
0
        private async Task SpeakFilmInfo(FilmInfo fi)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(fi.Title);
            sb.AppendFormat("classification {0}\n", fi.Classification);

            sb.AppendFormat("release date {0}", fi.Release.ToLongDateString());

            await SpeechSynthesisService.SpeakOutLoud(sb.ToString());
        }
        public ActionResult Edit(int id)
        {
            ViewBag.Message = "Введите информацию о фильме";
            ViewBag.Title   = "Редактироание карточки фильма.";
            SelectList items = new SelectList(_db.GetAllGenres(), "Id", "Name");

            ViewBag.Genres = items;
            FilmInfo tempCard = _db.GetCard(id);

            return(View(tempCard));
        }
        public void UpdateCell(FilmInfo film, UIImage image)
        {
            this.Film = film;

            this.Header.Text                     = film.TitleWithClassification;
            this.Description.Text                = film.ShortDesc;
            this.Poster.Image                    = image;
            this.Poster.Layer.CornerRadius       = 10f;
            this.Poster.Layer.MasksToBounds      = true;
            this.Poster.Layer.RasterizationScale = UIScreen.MainScreen.Scale;
            this.Poster.Layer.Opaque             = true;

            this.Duration.Text = String.Format("Duration: {0} mins", film.Runtime);

            PDRatingView ratingView;
            UILabel      reviewCount;

            foreach (var sub in this.Rating.Subviews)
            {
                sub.RemoveFromSuperview();
            }

            //if(this.Rating.Subviews.Length == 0)
            //{
            // Create the view.
            ratingView = new PDRatingView(new RectangleF(0f, 0f, 50f, 30f), ratingConfig, Convert.ToDecimal(film.AverageRating));

            // [Required] Add the view to the
            this.Rating.AddSubview(ratingView);

            reviewCount      = new UILabel(new RectangleF(60f, 0f, 60f, 30f));
            reviewCount.Font = this.Duration.Font;
            reviewCount.Text = String.Format("{0} ratings", film.Reviews.Count);
            this.Rating.AddSubview(reviewCount);
            //}
            //else
            //{
            //	foreach(var sub in this.Rating.Subviews)
            //	{
            //		ratingView = sub as PDRatingView;
            //		if(ratingView != null)
            //		{
            //			ratingView.AverageRating = Convert.ToDecimal (film.AverageRating);
            //			break;
            //		}
            //
            //		reviewCount = sub as UILabel;
            //		if (reviewCount != null)
            //		{
            //			reviewCount.Text = String.Format ("{0} ratings", film.Reviews.Count);
            //		}
            //	}
            //}
        }
Exemple #21
0
        private void Image_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FilmInfo fi = (FilmInfo)(sender as Image).Tag;

            List <FilmInfo> films = App.CinemaFilms[SelectedCinema.ID];

            ShowPerformances.SelectedFilm      = films.First(f => f.EDI == fi.EDI);
            ShowPerformances.SelectedCinema    = SelectedCinema;
            ShowPerformances.ShowCinemaDetails = false;
            ShowPerformances.ShowFilmDetails   = true;
            NavigationService.Navigate(new Uri("/ShowPerformances.xaml", UriKind.Relative));
        }
Exemple #22
0
        public string Delete(string id)
        {
            FilmInfo film = cinemaContext.FilmInfo.FirstOrDefault(x => x.Id.ToString().Equals(id));

            if (film == null)
            {
                return(JsonConvert.SerializeObject("Фильм не найден!"));
            }
            cinemaContext.FilmInfo.Remove(film);
            cinemaContext.SaveChangesAsync();
            return(JsonConvert.SerializeObject("Успешно удален!"));
        }
        public ActionResult Create()
        {
            ViewBag.Message = "Введите информацию о фильме";
            ViewBag.Title   = "Создание карточки фильма.";
            SelectList items = new SelectList(_db.GetAllGenres(), "Id", "Name");

            ViewBag.Genres = items;
            FilmInfo newFilmInfoCard = new FilmInfo();

            newFilmInfoCard.Id = _db.GetMaxCardId();
            return(View(newFilmInfoCard));
        }
        void miAllow_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mi = sender as MenuItem;

            if (mi != null)
            {
                ContextMenu cm = mi.Parent as ContextMenu;

                FilmInfo fi = (FilmInfo)cm.Tag;

                this.posterViewModel.AllowFilm(fi);
            }
        }
Exemple #25
0
 private void FilmInfoToForm(FilmInfo filmInfo)
 {
     tbRussianTitle.Text  = filmInfo.russianTitle;
     tbOriginalTitle.Text = filmInfo.originalTitle;
     tbYear.Text          = filmInfo.year;
     tbCountry.Text       = filmInfo.country;
     tbGenre.Text         = filmInfo.genre;
     tbDirector.Text      = filmInfo.director;
     rtbActors.Text       = filmInfo.actors;
     tbWorldDate.Text     = filmInfo.worldPremiere;
     tbRussianDate.Text   = filmInfo.russianPremiere;
     tbDiscDate.Text      = filmInfo.discPremiere;
 }
Exemple #26
0
        private async void FilmListing_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FilmInfo newFI = null;

            if (sender is Image)
            {
                Image img = sender as Image;

                newFI = img.Tag as FilmInfo;
            }
            else if (sender is Grid)
            {
                Grid grid = sender as Grid;

                newFI = grid.Tag as FilmInfo;
            }
            else
            {
                return;
            }

            if (newFI == null)
            {
                return;
            }

            if (!Config.AudioSupport || fi == newFI)
            {
                List <FilmInfo> films = App.CinemaFilms[SelectedCinema.ID];

                ShowPerformances.SelectedFilm      = films.First(f => f.EDI == newFI.EDI);
                ShowPerformances.SelectedCinema    = SelectedCinema;
                ShowPerformances.ShowCinemaDetails = false;
                ShowPerformances.ShowFilmDetails   = true;

                NavigationService.Navigate(new Uri("/ShowPerformances.xaml", UriKind.Relative));
            }
            else
            {
                fi = newFI;

                if (this.pMain.SelectedIndex == 0)
                {
                    await SpeakFilmInfoWithShowTimes(newFI);
                }
                else
                {
                    await SpeakFilmInfo(newFI);
                }
            }
        }
Exemple #27
0
        private void Image_Tapped(object sender, TappedRoutedEventArgs e)
        {
            FilmInfo fi = (FilmInfo)(sender as Image).Tag;

            List <FilmInfo> films = App.CinemaFilms[SelectedCinema.ID];

            ShowPerformances.SelectedFilm = films.Find(f => f.EDI == fi.EDI);

            ShowPerformances.SelectedCinema    = SelectedCinema;
            ShowPerformances.ShowFilmDetails   = true;
            ShowPerformances.ShowCinemaDetails = false;

            this.Frame.Navigate(typeof(ShowPerformances));
        }
        public ActionResult Edit(FilmInfo film)
        {
            Genre genre = _db.GetAllGenres().FirstOrDefault(x => x.Id == film.GenreId);

            if (genre != null)
            {
                ApplicationUser user = UserManager.FindById(User.Identity.GetUserId());

                film.User  = user.UserName;
                film.Email = user.Email;
                film.Genre = genre;
                string   tempPath      = HostingEnvironment.MapPath("~/posterPicStore/") + film.PosterFilePAth;
                FileInfo tempFileInfo  = new FileInfo(tempPath);
                bool     pathExistFlag = tempFileInfo.Exists;
                if (!(pathExistFlag))
                {
                    string prevPath = _db.GetPicCardPath(film.Id);
                    bool   fileInfo = false;
                    if (prevPath != null)
                    {
                        fileInfo = (new FileInfo(HostingEnvironment.MapPath("~/posterPicStore/") + Path.GetFileName(prevPath))).Exists;
                    }
                    if (fileInfo == true)
                    {
                        film.PosterFilePAth = prevPath;
                    }
                    else
                    {
                        film.PosterFilePAth = "/posterPicStore/default.jpg";
                    }
                }
                else
                {
                    film.PosterFilePAth = "/posterPicStore/" + film.PosterFilePAth;
                }
                if (ModelState.IsValid)
                {
                    _db.UpdateCard(film);
                    return(RedirectToAction("Index"));
                }
            }

            ViewBag.Message = "Введите информацию о фильме";
            ViewBag.Title   = "Редактироание карточки фильма.";
            SelectList items = new SelectList(_db.GetAllGenres(), "Id", "Name");

            ViewBag.Genres = items;
            return(View(_db.GetCard(film.Id)));
        }
Exemple #29
0
        public string InsertFilm(string film)
        {
            FilmInfo filmObject = JsonConvert.DeserializeObject <FilmInfo>(film);
            string   output     = "";
            var      parameters = new { Id = filmObject.id, Title = filmObject.title, Overview = filmObject.overview, PosterPath = filmObject.poster_path, ReleaseDate = filmObject.release_date, GenreIds = String.Join(',', filmObject.genre_ids), BackdropPath = filmObject.backdrop_path, VoteAverage = filmObject.vote_average };
            string   query      = "INSERT INTO MOVIES (Id, Title, Overview, Poster_Path, Release_Date, Genre_Ids_String, Backdrop_Path, Vote_Average) VALUES (@Id, @Title, @Overview, @PosterPath, @ReleaseDate, @GenreIds, @BackdropPath, @VoteAverage)";

            SqlConnection sqlConnection = new SqlConnection(_connectionString);

            using (var db = sqlConnection)
            {
                db.Open();
                output = db.Query <string>(query, parameters).FirstOrDefault();
            }
            return(output);
        }
Exemple #30
0
        public string DeleteFilm(string film)
        {
            FilmInfo filmObject = JsonConvert.DeserializeObject <FilmInfo>(film);
            string   output     = "";
            var      parameters = new { Id = filmObject.id };
            string   query      = "DELETE FROM MOVIES WHERE ID = @Id";

            SqlConnection sqlConnection = new SqlConnection(_connectionString);

            using (var db = sqlConnection)
            {
                db.Open();
                output = db.Query <string>(query, parameters).FirstOrDefault();
            }
            return(output);
        }