Example #1
0
        public ActionResult UpdateEdit(string hiddenId, 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         = hiddenId;
                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;
                }
                int i = _newsContentsService.UpdateNewsContents(contents);
                if (i > 0)
                {
                    status = "success";
                    msg    = "更新成功!";
                }
            }
            catch (Exception exception)
            {
                msg = "更新出错!";
                Log4Dao.InsertLog4(exception.Message);
            }
            json = PublicFunc.ModelToJson(status, msg);
            return(Content(json));
        }