Exemple #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            PhotoService ps = new PhotoService();

            ps.CreateAndConfigureAsync();
        }
Exemple #2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            DependenciesConfig.RegisterDependencies();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            PhotoService photoService = new PhotoService(new Logger());

            photoService.CreateAndConfigureAsync();

            DbConfiguration.SetConfiguration(new MyFixIt.Persistence.EFConfiguration());
        }
Exemple #3
0
        public async Task <ActionResult> Create([Bind(Include = "id,title,imageURL,category,publishedDate")] ad ad, HttpPostedFileBase photo)
        {
            if (ModelState.IsValid)
            {
                PhotoService photoservice = new PhotoService();
                photoservice.CreateAndConfigureAsync();
                ad.imageURL = await photoservice.UploadPhotoAsync(photo);

                ad.publishedDate = DateTime.UtcNow;
                db.Ads.Add(ad);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(ad));
        }
Exemple #4
0
        public async Task <ActionResult> Create([Bind(Include = "idad,adTitle,adDescription,adMediaUrl,adArea,adPublishedDate,adPublishedDate,adMinor")] adModels ad, HttpPostedFileBase photo)
        {
            if (ModelState.IsValid)
            {
                PhotoService photoservice = new PhotoService();
                photoservice.CreateAndConfigureAsync();
                ad.adMediaUrl = await photoservice.UploadPhotoAsync(photo);

                ad.adPublishedDate = DateTime.UtcNow;
                ad.adFinishedDate  = DateTime.UtcNow;
                db.ad.Add(ad);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(ad));
        }