コード例 #1
0
        public ActionResult UpdateArticleAdd(HttpPostedFileBase Image, bool?chkPublish, ArticlesTable articleTable)
        {
            var seoMake = Seo.Translate(articleTable.ArticleTitle);

            string filePath  = articleTable.Image;
            int    PublishId = articleTable.PublishId;

            if (Image != null)
            {
                filePath = Path.GetFileName(Image.FileName);
                filePath = seoMake + ".jpg";
                var uploadPath = Path.Combine(Server.MapPath("~/Content/Images/"), filePath);
                Image.SaveAs(uploadPath);
            }

            if (chkPublish == true)
            {
                PublishId = 1;
            }
            else
            {
                PublishId = 0;
            }

            _modelArticle.UpdateArticleData(articleTable.ArticleTitle, articleTable.ArticleAuthor,
                                            articleTable.ArticleContent, articleTable.ArticleTags, DateTime.Now, seoMake, PublishId, filePath, articleTable.ArticleID);

            return(RedirectToAction("Index", "AdmArticles"));
        }
コード例 #2
0
        public ActionResult UpdateFilesAdd(HttpPostedFileBase FileImage, bool? chkPublish, FilesTable fileTable)
        {
            var seoMake = Seo.Translate(fileTable.FileTitle);

            string imagePath = fileTable.FileImage;
            int publishId = 0;
            if (FileImage != null)
            {
                imagePath = Path.GetFileName(FileImage.FileName);
                imagePath = seoMake + ".jpg";
                var uploadPath = Path.Combine(Server.MapPath("~/Content/Images/"), imagePath);
                FileImage.SaveAs(uploadPath);


            }

            if (chkPublish == true)
            {

                publishId = 1;

            }

            _modelFiles.UpdateFileData(fileTable.FileTitle, fileTable.FileAuthor, fileTable.FileContent, fileTable.FileTags, DateTime.Now, seoMake, publishId, imagePath, fileTable.FileID);

            return RedirectToAction("Index", "AdmFiles");

        }
コード例 #3
0
        public ActionResult FilesAdd(HttpPostedFileBase Image, HttpPostedFileBase FileStream, bool chkPublish, FilesTable fileTable)
        {
            string filePath = "Dosya Yok!";
            string imagePath = "content-icon.png";
            int publishId = 0;
            var seoMake = Seo.Translate(fileTable.FileTitle);

            if (FileStream != null)
            {
                filePath = Path.GetFileName(FileStream.FileName);


                var uploadPath = Path.Combine(Server.MapPath("~/Content/Files/"), filePath);
                FileStream.SaveAs(uploadPath);

            }

            if (Image != null)
            {
                imagePath = Path.GetFileName(Image.FileName);
                imagePath = seoMake + ".jpg";
                var uploadPath = Path.Combine(Server.MapPath("~/Content/Images/"), imagePath);
                Image.SaveAs(uploadPath);
            }

            if (chkPublish == true)
            {

                publishId = 1;

            }


            _modelFiles.AddFileData(fileTable.FileTitle, fileTable.FileAuthor, fileTable.FileContent,
                    fileTable.FileTags, filePath, DateTime.Now, seoMake, publishId, imagePath);

            return RedirectToAction("Index", "AdmFiles");
        }
コード例 #4
0
        public ActionResult UpdateWhatIDoAdd(HttpPostedFileBase Image, bool?chkPublish, WhatIDoTable whatIDoTable)
        {
            var    seoMake   = Seo.Translate(whatIDoTable.WhatIDoTitle);
            string filePath  = whatIDoTable.WhatIDoImage;
            int    publishId = whatIDoTable.PublishId;

            if (Image != null)
            {
                filePath = Path.GetFileName(Image.FileName);
                filePath = seoMake + ".jpg";
                var uploadPath = Path.Combine(Server.MapPath("~/Content/Images/"), filePath);
                Image.SaveAs(uploadPath);
            }

            if (chkPublish == true)
            {
                publishId = 1;
            }
            _modelWhatIDo.UpdateWhatIDoData(whatIDoTable.WhatIDoTitle, whatIDoTable.WhatIDoContent,
                                            whatIDoTable.WhatIDoTags, DateTime.Now, seoMake, publishId, filePath, whatIDoTable.WhatIDoID);

            return(RedirectToAction("Index", "AdmWhatIDo"));
        }