Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,ime,podrijetlo,vrsta,godina,kilaza,komada")] SpecialEdition specialEdition)
        {
            if (id != specialEdition.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(specialEdition);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpecialEditionExists(specialEdition.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(specialEdition));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("ID,ime,podrijetlo,vrsta,godina,kilaza,komada")] SpecialEdition specialEdition)
        {
            if (ModelState.IsValid)
            {
                _context.Add(specialEdition);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(specialEdition));
        }
Esempio n. 3
0
        /// <summary>
        /// Saves the Settings
        /// </summary>
        public static void SaveSettings()
        {
            Logger.Debug("Saving IMDb+ options to file.");

            #region Scraper
            XmlWriter xmlWriter = new XmlWriter();
            if (!xmlWriter.Load(OptionsFile))
            {
                if (File.Exists(OptionsFile))
                {
                    try
                    {
                        File.Delete(OptionsFile);
                    }
                    catch (Exception e)
                    {
                        Logger.Error("Error deleting file: '{0}'", OptionsFile);
                        Logger.Error("Exception: {0}", e.Message);
                        return;
                    }
                }

                // create it
                Logger.Info("Creating new IMDb+ options file.");
                xmlWriter.CreateXmlConfigFile(OptionsFile);
                xmlWriter.Load(OptionsFile);
            }

            xmlWriter.SetOptionsEntry(cOriginalTitle, "01", OriginalTitle.ToString());
            xmlWriter.SetOptionsEntry(cForeignTitle, "02", ForeignTitle.ToString());
            xmlWriter.SetOptionsEntry(cForeignFirst, "03", ForeignFirst.ToString());
            xmlWriter.SetOptionsEntry(cUkRating, "04", UkRating.ToString());
            xmlWriter.SetOptionsEntry(cIMDbScore, "05", IMDbScore.ToString());
            xmlWriter.SetOptionsEntry(cIMDbMetaScore, "06", IMDbMetaScore.ToString());
            xmlWriter.SetOptionsEntry(cLongSummary, "07", LongSummary.ToString());
            xmlWriter.SetOptionsEntry(cRottenMeter, "08", RottenMeter.ToString());
            xmlWriter.SetOptionsEntry(cRottenAverage, "09", RottenAverage.ToString());
            xmlWriter.SetOptionsEntry(cRottenTopCritics, "10", RottenTopCritics.ToString());
            xmlWriter.SetOptionsEntry(cSpecialEdition, "11", SpecialEdition.ToString());
            xmlWriter.SetOptionsEntry(cRenameTitles, "12", RenameTitles.ToString());
            xmlWriter.SetOptionsEntry(cSingleScore, "13", SingleScore.ToString());
            xmlWriter.SetOptionsEntry(cMinIMDbVotes, "14", MinIMDbVotes.ToString());
            xmlWriter.SetOptionsEntry(cRefreshAllFields, "15", RefreshAllFields.ToString());
            xmlWriter.SetOptionsEntry(cOneWriterDirector, "16", OneWriterDirector.ToString());
            xmlWriter.SetOptionsEntry(cRemoveFirstRoman, "17", RemoveFirstRoman.ToString());
            xmlWriter.SetOptionsEntry(cFixMissingSummary, "18", FixMissingSummary.ToString());

            xmlWriter.SetOptionsEntry(cRatings, "94", Ratings);
            xmlWriter.SetOptionsEntry(cSecondaryEnglishTitle, "95", SecondaryEnglishTitle.ToString());
            xmlWriter.SetOptionsEntry(cSecondarySummary, "96", SecondarySummary.ToString());
            xmlWriter.SetOptionsEntry(cSecondaryDetails, "97", SecondaryDetails);
            xmlWriter.SetOptionsEntry(cCountryFilter, "98", CountryFilter);
            xmlWriter.SetOptionsEntry(cLanguageFilter, "99", LanguageFilter);

            // save file
            xmlWriter.Save(OptionsFile);
            #endregion

            #region Plugin
            using (Settings xmlwriter = new MPSettings())
            {
                xmlwriter.SetValue(cSection, cSyncInterval, SyncInterval.ToString());
                xmlwriter.SetValueAsBool(cSection, cSyncOnStartup, SyncOnStartup);
                xmlwriter.SetValue(cSection, cSyncLastDateTime, SyncLastDateTime.ToString());
                xmlwriter.SetValueAsBool(cSection, cDisableNotifications, DisableNotifications);
                xmlwriter.SetValue(cSection, cMoviesRefreshed, MoviesRefreshed.ToJSON());
            }
            Settings.SaveCache();
            #endregion
        }