예제 #1
0
        public async Task <IActionResult> Insert([FromBody] Person person)
        {
            if (person is null)
            {
                return(BadRequest(new ArgumentNullException()));
            }

            person.Timestamp = DateTime.UtcNow;
            var entity = await _personGateway.Insert(person);

            _publisherAdded.Publish(new PersonAddedMessage(entity.Id));

            return(CreatedAtAction(nameof(GetById), new { id = entity.Id }, entity));
        }
 public Task <Person> Insert(Person person) =>
 ExecuteFunction(() => _decoratee.Insert(person), "mongo_person_insert");