コード例 #1
0
ファイル: ReleasesController.cs プロジェクト: RonenZ/EitanMVC
        public ActionResult Create(Release Entity, SEO SEOEntity, HttpPostedFileBase[] SEOfile)
        {
            if (ModelState.IsValid)
            {
                var mainImage = WebImage.GetImageFromRequest("UploadedMainImage");
                var rectImage = WebImage.GetImageFromRequest("UploadedRectImage");

                if (mainImage != null)
                    Entity.MainImage = Server.MapPath("/Images/Releases/").SaveImage(mainImage, true, 315, 315);
                if (rectImage != null)
                    Entity.RectImage = Server.MapPath("/Images/Releases/").SaveImage(rectImage, false);

                if (SEOEntity != null && SEOfile != null && SEOfile.Length > 0)
                {
                    if (SEOfile != null)
                        SEOEntity.ogImage = SEOfile.FBSaveImages(Server.MapPath("/Images/SEO/"), "News");
                }
                Entity.Date_Creation = DateTime.Now;
                Uow.ReleaseRepository.Add(Entity);

                Uow.Commit();

                return RedirectToAction("Index");
            }

            ViewBag.Labels = Uow.ReleaseRepository.GetAllLabels().ToList();

            return View(Entity);
        }
コード例 #2
0
        protected void UpsertSEO(IWithSEO Entity, int SEOID, SEO POSTSEO, HttpPostedFileBase[] SEOfile, string ModelName)
        {
            if (SEOID > 0)
            {
                var SEOEntity = Uow.SEORepository.GetByID(SEOID);
                UpdateModel(SEOEntity);
            }
            else if (POSTSEO != null)
            {
                Uow.SEORepository.Add(POSTSEO);
                Uow.Commit();
                Entity.SeoId = POSTSEO.SEO_ID;
            }

            if (SEOfile != null && SEOfile[0] != null)
                Entity.SEO.ogImage += SEOfile.FBSaveImages(Server.MapPath("/Images/SEO/"), ModelName);
        }
コード例 #3
0
ファイル: ProjectsController.cs プロジェクト: RonenZ/EitanMVC
        public ActionResult Create(Project Entity, SEO SEOEntity, HttpPostedFileBase[] SEOfile)
        {
            if (ModelState.IsValid)
            {
                var image = WebImage.GetImageFromRequest("UploadedImage");

                if (image != null)
                    Entity.MainImage = Server.MapPath("/Images/Projects/").SaveImage(image);

                if (SEOEntity != null && SEOfile != null && SEOfile.Length > 0)
                {
                    if (SEOfile != null)
                        SEOEntity.ogImage = SEOfile.FBSaveImages(Server.MapPath("/Images/SEO/"), "News");
                }
                Entity.Date_Creation = DateTime.Now;
                Uow.ProjectRepository.Add(Entity);

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(Entity);
        }