Esempio n. 1
0
        public ActionResult SaveAdd(string newsMenuId, string newsType, string newsTitle, string httpUrl, string attachId, string indexImg, string attachContent1, string attachContent2, string attachContent3, string attachContent4, string content)
        {
            string status = "failue", msg = "保存失败!", json;

            try
            {
                NewsContents contents = new NewsContents();
                contents.Id         = CustomId.GetCustomId();
                contents.NewsMenuId = newsMenuId;
                contents.NewsTitle  = newsTitle;
                contents.NewsType   = newsType.StringToInt();
                switch (contents.NewsType)
                {
                case 2015014:
                    contents.AttachContent1 = attachContent1;
                    contents.AttachContent2 = attachContent2;
                    contents.AttachContent3 = attachContent3;
                    contents.AttachContent4 = attachContent4;
                    contents.IndexImg       = indexImg;
                    contents.NewsContent    = content;
                    break;

                case 2015015:
                    contents.HttpUrl = httpUrl;
                    break;

                case 2015016:
                    contents.AttachId = attachId;
                    break;
                }
                contents.RleaseTime = DateTime.Now;
                contents.NewsStatus = 2015009;//未通过审核
                int i = _newsContentsService.InsertNewsContents(contents);
                if (i > 0)
                {
                    status = "success";
                    msg    = "保存成功!";
                }
            }
            catch (Exception exception)
            {
                msg = "保存出错!";
                Log4Dao.InsertLog4(exception.Message);
            }
            json = PublicFunc.ModelToJson(status, msg);
            return(Content(json));
        }