Exemplo n.º 1
0
        public Response <AddNoteAndContentsResponse> AddNoteAndContents(TokenRequest <AddNoteAndContentsRequest> request)
        {
            Response <AddNoteAndContentsResponse> response = new Response <AddNoteAndContentsResponse>();

            try
            {
                if (request == null || request.RequestData == null)
                {
                    response.Code         = -1;
                    response.Description  = "请求参数为空!";
                    response.ResponseData = null;
                }
                else
                {
                    NoteManager          manager = new NoteManager(request.Version);
                    ManagerResult <bool> result  = manager.AddNoteAndContents(request.RequestData.Note, request.RequestData.NoteContents);
                    response.GetResultInfo(result);

                    if (result.ResultData)
                    {
                        response.ResponseData = new AddNoteAndContentsResponse()
                        {
                            Note         = request.RequestData.Note,
                            NoteContents = request.RequestData.NoteContents
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(LogType.Error, ex);
                response.Code = -1;
            }

            return(response);
        }