示例#1
0
        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
        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);
        }
示例#3
0
        public virtual void Add(SEO Entity)
        {
            if (DbSet == null) DbSet = DbContext.Set<SEO>();

            DbEntityEntry DbEntityEntry = DbContext.Entry(Entity);
            if (DbEntityEntry.State != EntityState.Detached)
                DbEntityEntry.State = EntityState.Added;
            else
                DbSet.Add(Entity);
        }
示例#4
0
        public virtual void Delete(SEO Entity)
        {
            if (DbSet == null) DbSet = DbContext.Set<SEO>();

            DbEntityEntry DbEntityEntry = DbContext.Entry(Entity);
            if (DbEntityEntry.State != EntityState.Deleted)
            {
                DbEntityEntry.State = EntityState.Deleted;
            }
            else
            {
                DbSet.Attach(Entity);
                DbSet.Remove(Entity);
            }
        }
示例#5
0
        public ActionResult Edit(Artist EditEntity, int id, SEO POSTSEO, int SEOID = 0)
        {
            if (ModelState.IsValid)
            {
                var Entity = Uow.ArtistRepository.GetByID(id);

                UpdateModel(Entity);

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(EditEntity);
        }
示例#6
0
        public ActionResult Create(Page Entity, SEO SEOEntity, HttpPostedFileBase[] SEOfile)
        {
            if (ModelState.IsValid)
            {
                UpsertSEO(Entity, 0, SEOEntity, SEOfile, "Pages");

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

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(Entity);
        }
示例#7
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);
        }
示例#8
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);
        }
示例#9
0
        public ActionResult Create(Release Entity, SEO SEOEntity, HttpPostedFileBase[] SEOfile)
        {
            if (ModelState.IsValid)
            {
                Entity.Date_Creation = DateTime.Now;

                ReleasesUpsert(Entity, SEOEntity, SEOfile);

                Uow.ReleaseRepository.Add(Entity);

                Uow.Commit();

                return RedirectToAction("Index");
            }

            ViewBagReleases();

            return View(Entity);
        }
示例#10
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);
        }
示例#11
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);
        }
示例#12
0
        public ActionResult Edit(Release EditEntity, int id, SEO POSTSEO, int SEOID = 0)
        {
            if (ModelState.IsValid)
            {
                var Entity = Uow.ReleaseRepository.GetByID(id);

                var mainImage = WebImage.GetImageFromRequest("UploadedMainImage");
                var rectImage = WebImage.GetImageFromRequest("UploadedRectImage");
                UpdateModel(Entity);

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

                Uow.Commit();

                return RedirectToAction("Index");
            }

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

            return View(EditEntity);
        }
示例#13
0
        private void ReleasesUpsert(Release Entity, SEO SEOEntity, HttpPostedFileBase[] SEOfile)
        {
            var rectImage = WebImage.GetImageFromRequest("UploadedRectImage");

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

            InsertImage(Entity, "UploadedMainImage", "Releases");

            UpsertSEO(Entity, SEOEntity.SEO_ID, SEOEntity, SEOfile, "Releases");
        }
示例#14
0
        public ActionResult Edit(Page EditEntity, int id, SEO POSTSEO, HttpPostedFileBase[] SEOfile, int SEOID = 0)
        {
            if (ModelState.IsValid)
            {
                var Entity = Uow.PagesRepository.GetByID(id);
                UpdateModel(Entity);

                UpsertSEO(Entity, SEOID, POSTSEO, SEOfile, "Pages");

                Uow.Commit();

                return RedirectToAction("Index");
            }

            return View(EditEntity);
        }
示例#15
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);
        }
示例#16
0
        public ActionResult Edit(Release EditEntity, int id, SEO POSTSEO, int SEOID = 0)
        {
            if (ModelState.IsValid)
            {
                var Entity = Uow.ReleaseRepository.GetByID(id);

                UpdateModel(Entity);

                ReleasesUpsert(Entity, POSTSEO, null);

                Uow.Commit();

                return RedirectToAction("Index");
            }
            ViewBag.RelID = id;
            ViewBagReleases();

            return View(EditEntity);
        }
示例#17
0
        public virtual void Update(SEO Entity)
        {
            if (DbSet == null) DbSet = DbContext.Set<SEO>();

            DbEntityEntry DbEntityEntry = DbContext.Entry(Entity);

            if (DbEntityEntry.State == EntityState.Detached)
                DbSet.Attach(Entity);

            DbEntityEntry.State = EntityState.Modified;
        }