Esempio n. 1
0
        public async Task <IActionResult> Insert([FromBody] CreatePersonCommand command)
        {
            try
            {
                Response <IPersonCreatedEvent> response =
                    await _createPersonClient.GetResponse <IPersonCreatedEvent>(command);

                return(Ok(_factory.Data(response.Message)));
            }
            catch (MongoWriteException exception)
            {
                return(CreateExceptionError(exception, "1001", "Error writing new person"));
            }
            catch (ArgumentNullException exception)
            {
                return(CreateExceptionError(exception, "1001", "Error writing new person"));
            }
        }