public JsonResult GetContent(int id) { var view = new AutoReplyNewView(); view.Main = _autoReplyService.GetDetail(id); if (view.Main.Contents[0].IsNewContent.Value) { view.Send = JsonConvert.DeserializeObject <List <NewsInfoView> >(view.Main.Contents[0].Content); } else { if (view.Main.Contents[0].PrimaryType == (int)AutoReplyContentEnum.TEXT) { view.Send = new List <NewsInfoView>() { new NewsInfoView() { NewsCate = "text", NewsContent = view.Main.Contents[0].Content, isSecurityPost = view.Main.Contents[0].IsEncrypt } }; } else if ((view.Main.Contents[0].PrimaryType == (int)AutoReplyContentEnum.VIDEO || view.Main.Contents[0].PrimaryType == (int)AutoReplyContentEnum.VOICE || view.Main.Contents[0].PrimaryType == (int)AutoReplyContentEnum.IMAGE || view.Main.Contents[0].PrimaryType == (int)AutoReplyContentEnum.FILE) && view.Main.Contents[0].FileID.HasValue) { var fileInfo = _fileManageService.GetById <AttachmentsItemView>(view.Main.Contents[0].FileID.Value); view.Send = new List <NewsInfoView>() { new NewsInfoView() { NewsCate = Enum.Parse(typeof(AutoReplyContentEnum), view.Main.Contents[0].PrimaryType.ToString()).ToString().ToLower(), NewsContent = "", AppId = view.Main.AppId, NewsTitle = fileInfo.AttachmentTitle, ImageContent = "/" + fileInfo.ThumbUrl, VideoContent = "/" + fileInfo.AttachmentUrl, FileSrc = "/" + fileInfo.AttachmentUrl, SoundSrc = "/" + fileInfo.AttachmentUrl, MediaId = fileInfo.MediaId, NewsComment = fileInfo.Description, isSecurityPost = view.Main.Contents[0].IsEncrypt, RealFileName = fileInfo.AttachmentTitle } }; } else if (view.Main.Contents[0].PrimaryType == (int)AutoReplyContentEnum.NEWS && !string.IsNullOrEmpty(view.Main.Contents[0].NewsID)) { var ListArticle = _articleInfoService.GetListByNewsIDs(view.Main.Contents[0].NewsID); string strCate = Enum.Parse(typeof(AutoReplyContentEnum), view.Main.Contents[0].PrimaryType.ToString()).ToString().ToLower(); ListArticle.ForEach(a => { a.NewsCate = strCate; a.isSecurityPost = view.Main.Contents[0].IsEncrypt; a.NewsID = view.Main.Contents[0].NewsID; }); view.Send = ListArticle; } } view.GetExtraContent(view.Main.Contents); return(Json(view, JsonRequestBehavior.AllowGet)); }