public IActionResult Post([FromBody] ViewModel.DocTypeViewModel docTypeViewModel) { /*判断是否合法*/ if (ModelState.IsValid) { try { string strDocTypeInfo = string.Empty; bool isDocTypeAdd = DocTypeConfig.Add(docTypeViewModel.DocTypeName, 1, docTypeViewModel.DocPreTypeId, docTypeViewModel.DocTypeDeptId, docTypeViewModel.DocTypeNum, this.User.Identities.First(u => u.IsAuthenticated).FindFirst("UsrId").Value); /*判断是否新增成功*/ return(!isDocTypeAdd ? Ok(new { result = false, tips = ResponseMessageTips.MSG_DOCTYPE_ADD_FAIL }) : Ok(new { result = true, tips = ResponseMessageTips.MSG_DOCTYPE_ADD_SUCCESS })); } catch (Exception e) { return(Ok(new { result = false, tips = ResponseMessageTips.MSG_PROCESS_EXCEPTION + e.Message.ToString() })); } } return(Ok(new { result = false, tips = ResponseMessageTips.MSG_PROCESS_DATA_FORMAT_ERROR })); }