public async Task <ApiResult> DelAllData(NoticeDetailModel model) { log.DebugFormat($"清数据库数据开始"); await adminService.DelAll(); log.DebugFormat($"清数据库数据完成"); return(new ApiResult { status = 1, msg = "完成" }); }
public async Task <ApiResult> Detail(NoticeDetailModel model) { var n = await noticeService.GetModelAsync(model.Id); if (n == null) { return(new ApiResult { status = 0, msg = "公告不存在" }); } NoticeListApiModel res = new NoticeListApiModel { id = n.Id, content = n.Content, code = n.Code }; return(new ApiResult { status = 1, data = res }); }
public JsonResult GetNotice(int id) { var notice = this.noticeService.GetNotice(id); var noticeModel = new NoticeDetailModel(); if (notice != null) { noticeModel.Id = notice.Id; noticeModel.Title = notice.Title; noticeModel.Description = notice.Description; if (notice.Validity != null) { noticeModel.Validity = notice.Validity.Value.ToString("D"); } noticeModel.AttachFile = notice.AttachFile; if (noticeModel.AttachFile != null) { var extension = noticeModel.AttachFile.Substring(noticeModel.AttachFile.LastIndexOf('.') + 1); noticeModel.FileType = extension == "pdf" ? "pdf" : "image"; } } return(Json(noticeModel, JsonRequestBehavior.AllowGet)); }