コード例 #1
0
        public ActionResult AddDocument([FromBody] DocumentModel document)
        {
            _logger.LogInformation("Adding a new document");

            document.UploadedOn = DateTime.UtcNow;
            var documentData = DocumentMapper.SerializeDocument(document);
            var newDocument  = _documentService.CreateDocument(documentData);

            return(Ok(newDocument));
        }
コード例 #2
0
        public ActionResult UpdateDocument([FromBody] DocumentModel document)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var documentData = DocumentMapper.SerializeDocument(document);
            var newDocument  = _documentService.UpdateDocument(documentData);

            return(Ok(newDocument));
        }