Beispiel #1
0
        public async Task <ActionResult> PostKnowledgeEntryAsync(
            [EnsureNotNull][FromBody] KnowledgeEntryRecord Record
            )
        {
            Record.NewId();
            Record.Touch();
            await _knowledgeEntryService.InsertOneAsync(Record);

            return(Ok(Record.Id));
        }
Beispiel #2
0
        public async Task <ActionResult> PutKnowledgeEntryAsync(
            [EnsureNotNull][FromBody][EnsureEntityIdMatches("Id")] KnowledgeEntryRecord Record,
            [EnsureNotNull][FromRoute] Guid Id)
        {
            var existingRecord = await _knowledgeEntryService.FindOneAsync(Id);

            if (existingRecord == null)
            {
                return(NotFound($"No record found with it {Id}"));
            }

            Record.Touch();
            await _knowledgeEntryService.ReplaceOneAsync(Record);

            return(NoContent());
        }