Exemplo n.º 1
0
        public ActionResult Edit(News EditEntity, int id, SEO POSTSEO, int SEOID = 0)
        {
            if (ModelState.IsValid)
            {
                var Entity = Uow.NewsRepository.GetByID(id);

                var image = WebImage.GetImageFromRequest("UploadedImage");
                UpdateModel(Entity);

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

                //if (SEOID > 0)
                //{
                //    var SEOEntity = repo.GetSEOByID(SEOID);
                //    UpdateModel(SEOEntity);
                //}
                //else if (POSTSEO != null)
                //    Entity.SEO_ID = Uow.NewsRepository.InsertSEO(POSTSEO);

                //if (SEOfile != null)
                //    Entity.SEO.ogImage += SEOfile.FBSaveImages(Server.MapPath("/Images/SEO/"), "News");

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(EditEntity);
        }
Exemplo n.º 2
0
        public ActionResult Create(News Entity, SEO SEOEntity, HttpPostedFileBase[] SEOfile)
        {
            if (ModelState.IsValid)
            {
                InsertImage(Entity, "UploadedImage", "News");
                UpsertSEO(Entity, 0, SEOEntity, SEOfile, "News");

                Entity.Date_Creation = DateTime.Now;
                Uow.NewsRepository.Add(Entity);

                Uow.Commit();

                return RedirectToAction("Index");
            }
            return View(Entity);
        }
Exemplo n.º 3
0
        public ActionResult Create(News Entity, SEO SEOEntity, HttpPostedFileBase[] SEOfile)
        {
            if (ModelState.IsValid)
            {
                var image = WebImage.GetImageFromRequest("UploadedImage");

                if (image != null)
                    Entity.MainImage = Server.MapPath("/Images/News/").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.NewsRepository.Add(Entity);

                Uow.Commit();

                return RedirectToAction("Index");
            }
            return View(Entity);
        }
Exemplo n.º 4
0
        public ActionResult Edit(News EditEntity, int id, SEO POSTSEO, int SEOID = 0)
        {
            if (ModelState.IsValid)
            {
                var Entity = Uow.ProjectRepository.GetByID(id);

                var image = WebImage.GetImageFromRequest("UploadedImage");
                UpdateModel(Entity);

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

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(EditEntity);
        }
Exemplo n.º 5
0
        public ActionResult Edit(News EditEntity, int id, SEO POSTSEO, HttpPostedFileBase[] SEOfile, int SEOID)
        {
            if (ModelState.IsValid)
            {
                var Entity = Uow.NewsRepository.GetByID(id);
                UpdateModel(Entity);

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

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(EditEntity);
        }