Ejemplo n.º 1
0
        public async Task <ApiResult> DelAllData(NoticeDetailModel model)
        {
            log.DebugFormat($"清数据库数据开始");
            await adminService.DelAll();

            log.DebugFormat($"清数据库数据完成");
            return(new ApiResult {
                status = 1, msg = "完成"
            });
        }
Ejemplo n.º 2
0
        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
            });
        }
Ejemplo n.º 3
0
        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));
        }