public async Task <IActionResult> Edit(int cid, int type) { var VM = new ContentEditViewModel(); VM.Type = type; VM.content = new Project3.Data.Models.Contents(); VM.selectedmetas = new List <Project3.Data.Models.Metas>(); if (cid > 0) { VM.content = await cms.GetByCidAsync(cid); VM.selectedmetas = await cms.GetMetasAsync(cid); VM.files = await fms.GetFilesByCidAsync(cid); VM.Type = VM.content.type; } else { VM.files = await fms.GetFilesAsync(); } VM.metas = await mms.GetMetasAsync(-1); return(View(VM)); }
public async Task <string> GetTitleByCid(int cid) { var content = await cms.GetByCidAsync(cid); if (content != null) { return(content.title); } return(""); }
public async Task <IActionResult> Article(int cid) { var VM = new ArticleViewModel(); VM.content = await cms.GetByCidAsync(cid, false); if (VM.content == null) { Message.Show(new Widget.MessageModel() { Content = "内容似乎已经丢失,请返回首页。" }); } VM.metas = await cms.GetMetasAsync(cid); ViewData.Model = VM; await cms.UpdateReadnumAsync(cid, 1); return(View()); }