protected override bool PrepareAndCheckIfCanRun(object[] args)
        {
            if (ConfigurationManager.Config.ShouldUpdateOnlyUnfinishedEntries)
            {
                animes = animeService.GetCustom(e => e.Status != ContentStatus.FINISHED);
                mangas = mangaService.GetCustom(e => e.Status != ContentStatus.FINISHED);
            }
            else
            {
                animes = animeService.GetAll();
                mangas = mangaService.GetAll();
            }

            if (!animes.Any() && !mangas.Any())
            {
                ToastEvent.ShowToast(
                    ConfigurationManager.Config.ShouldUpdateOnlyUnfinishedEntries
                                                ? "Update didn't start - No unfinished animes or mangas to update."
                                                : "Update didn't start - No animes or mangas to update.",
                    ToastType.WARNING);

                return(false);
            }

            jobTitle       = "Animes and mangas update";
            jobMaxProgress = (animes.Count() + mangas.Count()) * 2;
            jobDescription = "Updating saved animes and mangas with latest info from anilst";

            return(true);
        }
Exemple #2
0
        public ActionResult Index(string contactValue)
        {
            HomeViewModel          model       = new HomeViewModel();
            List <Product>         products    = _productService.Get().ToList();
            List <Image>           images      = _imageService.GetAll().ToList();
            List <Manufactor>      manufactors = _manufactorService.GetAll().ToList();
            IEnumerable <Category> categories  = _categoryService.GetAll().ToList();
            IEnumerable <Anime>    animes      = _animeService.GetAll().ToList();

            model.products    = products;
            model.images      = images;
            model.manufactors = manufactors;
            model.categories  = categories;
            model.animes      = animes;
            model.wishLists   = User.Identity.IsAuthenticated ? _wishListService.GetAll().Where(m => m.UserID == User.Identity.GetUserId()) : null;

            if (contactValue != null)
            {
                ViewBag.ContactSuccessfull = "Your message was submit. We will contact you later!";
            }
            return(View(model));
        }