Ejemplo n.º 1
0
        public async Task <JsonResult> PostMarkdown([FromBody] Document entity)
        {
            //参数到底怎么传过来
            Document doc = new Document();

            try
            {
                if (entity.Id == 0)
                {
                    doc.KeyWords   = entity.KeyWords;
                    doc.Content    = entity.Content;
                    doc.CreateTime = DateTime.Now;
                    doc.Status     = 0;
                    doc.Title      = entity.Title;
                    await documentAppService.PostDocument(doc);
                }
                else
                {
                    doc.Id         = entity.Id;
                    doc.KeyWords   = entity.KeyWords;
                    doc.Content    = entity.Content;
                    doc.CreateTime = DateTime.Now;
                    doc.Status     = 0;
                    doc.Title      = entity.Title;
                    await documentAppService.PutDocument(doc);
                }

                return(Json(new AjaxResponse {
                    Success = true, Result = ""
                }));
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
                return(Json(new AjaxResponse {
                    Success = false, Result = ex.Message
                }));
            }
        }