示例#1
0
        public ActionResult ConvertNews(string title, New news, string _text, string _description)
        {
            NewService.FillParameters();

            if (UserService.user.admit == 4)
            {
                ViewBag.users = UserService.GetAllUsers();
            }
            HttpContext.Response.AddHeader("X-XSS-Protection", "0");
            news.text        = _text;
            news.description = _description;
            news.title       = title;
            if (String.IsNullOrWhiteSpace(news.text) || String.IsNullOrWhiteSpace(news.description) || String.IsNullOrWhiteSpace(news.title))
            {
                return(View("Index"));
            }
            if (isChangePicture)
            {
                if (!string.IsNullOrEmpty(ImageService.image))
                {
                    news.picture       = ImageService.image;
                    ImageService.image = string.Empty;
                }
                isChangePicture = !isChangePicture;
            }
            else
            {
                string picture;
                if ((picture = ImageService.GetPicture(changeNewId)) != "")
                {
                    news.picture = picture;
                }
            }

            NewService.ConvertNews(changeNewId, news);
            return(View("Index"));
        }