Exemplo n.º 1
0
        public ActionResult Create(Project Entity, SEO SEOEntity, HttpPostedFileBase[] SEOfile)
        {
            if (ModelState.IsValid)
            {
                InsertImage(Entity, "UploadedImage", "Projects");
                UpsertSEO(Entity, SEOEntity.SEO_ID, SEOEntity, SEOfile, "Projects");

                //Entity.Date_Creation = DateTime.Now;
                Uow.ProjectRepository.Add(Entity);

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(Entity);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public ActionResult Edit(Project EditEntity, int id, SEO POSTSEO, HttpPostedFileBase[] SEOfile, int SEOID = 0)
        {
            if (ModelState.IsValid)
            {
                var Entity = Uow.ProjectRepository.GetByID(id);
                UpdateModel(Entity);

                InsertImage(Entity, "UploadedImage", "Projects");
                UpsertSEO(Entity, POSTSEO.SEO_ID, POSTSEO, SEOfile, "Projects");

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(EditEntity);
        }