Exemple #1
0
        public static void Main()
        {
            MovieScrapper ms = new MovieScrapper("Exodus");

            ms.GetMovieName();
            ms.GetReleaseDate();
            ms.GetMovieGenres();
            ms.GetPlot();
            ms.GetRuntime();
            ms.GetCountries();
            ms.GetRating();
            ms.GetLanguages();
            ms.GetBudget();
            ms.GetRevenue();
            ms.GetPoster();
            ms.GetBackdrops();

            string path = Console.ReadLine();

            FileSystemChecker checker = new FileSystemChecker(path);

            checker.Run();
        }
Exemple #2
0
        public ActionResult AddApplication(AddViewModel app)
        {
            //TODO: ADD CATEGORIES TO APP, BEFORE RETURNING IT TO A VIEW!!! THROWS ARGUMENT NULL EXCEPTION FOR THE COLLECTION OF CATEGORIES
            if (app != null && ModelState.IsValid)
            {
                var newApplication = this.Mapper.Map <Application>(app.Application);

                //check if image file exists
                if (app.Image.UploadedImage != null)
                {
                    if (!FileSystemChecker.DirectoryExists(WebConstants.ImageFolder))
                    {
                        Directory.CreateDirectory(Server.MapPath(WebConstants.ImageFolder));
                    }

                    if (!FileSystemChecker.FileExists(WebConstants.ImageFolder, app.Image.UploadedImage.FileName))
                    {
                        app.Image.UploadedImage.SaveAs(Server.MapPath(string.Format("{0}/{1}", WebConstants.ImageFolder, app.Image.UploadedImage.FileName)));
                        var image = new AppImage
                        {
                            Name = app.Image.UploadedImage.FileName,
                            Path = string.Format("{0}/{1}", WebConstants.ImageFolder, app.Image.UploadedImage.FileName)
                        };

                        this.images.Add(image);
                        var dbImage = this.images.GetByName(image.Name);
                        if (dbImage.Path.IndexOf("\\") > -1)
                        {
                            dbImage.Path.Replace("\\", "/");
                        }

                        newApplication.AppImageId = dbImage.Id;
                    }
                    else
                    {
                        var storedImage = this.images.GetByName(app.Image.UploadedImage.FileName);
                        newApplication.AppImageId = storedImage.Id;
                    }
                }
                else
                {
                    // return view in case of missing application image file
                    return(View(this.HttpContext.Cache["addViewModel"]));
                }

                //check if application file exists
                if (app.Application.UploadedApplication != null)
                {
                    if (!FileSystemChecker.DirectoryExists(WebConstants.ApplicationFolder))
                    {
                        Directory.CreateDirectory(Server.MapPath(WebConstants.ApplicationFolder));
                    }

                    if (!FileSystemChecker.FileExists(WebConstants.ApplicationFolder, app.Application.UploadedApplication.FileName))
                    {
                        app.Application.UploadedApplication.SaveAs(Server.MapPath(string.Format("{0}/{1}", WebConstants.ApplicationFolder, app.Application.UploadedApplication.FileName)));
                        newApplication.Path = string.Format("{0}/{1}", WebConstants.ApplicationFolder, app.Application.UploadedApplication.FileName);
                    }
                    else
                    {
                        newApplication.Path = string.Format("{0}/{1}", WebConstants.ApplicationFolder, app.Application.UploadedApplication.FileName);
                    }

                    newApplication.CreatorId  = User.Identity.GetUserId();
                    newApplication.CategoryId = app.Application.CategoryId;
                    var savedApp        = this.applications.Add(newApplication);
                    var curentDeveloper = this.users.GetById(newApplication.CreatorId);
                    curentDeveloper.Applications.Add(savedApp);
                    return(RedirectToAction("Uploaded", "Applications"));
                }
                else
                {
                    // return view in case of missing application file
                    return(View(this.HttpContext.Cache["addViewModel"]));
                }
            }

            // return View(app);
            return(View(this.HttpContext.Cache["addViewModel"]));
        }