Exemplo n.º 1
0
        public async Task <IActionResult> PutAsync(int id, [FromBody] SaveDocResource resource)
        {
            var doc    = _mapper.Map <SaveDocResource, Doc>(resource);
            var result = await _docService.UpdateAsync(id, doc);

            if (!result.Success)
            {
                return(BadRequest(new ErrorResource(result.Message)));
            }

            var docResource = _mapper.Map <Doc, DocResource>(result.Resource);

            return(Ok(docResource));
        }
Exemplo n.º 2
0
        public async Task <UnifyResponseDto> UpdateAsync(long id, [FromBody] CreateUpdateDocDto updateDoc)
        {
            await _docService.UpdateAsync(id, updateDoc);

            return(UnifyResponseDto.Success("编辑文档成功"));
        }