Exemplo n.º 1
0
        public async Task <ActionResult> PostAsync([FromBody] People People)
        {
            if (People is null)
            {
                return(BadRequest("Объект пуст."));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest("Объект не прошел валидацию."));
            }
            await _dataRepository.AddAsync(People);

            return(CreatedAtRoute("GetPeople", new { Id = People.Id }, null));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> PostAsync([FromBody] AdresType adresType)
        {
            if (adresType is null)
            {
                return(BadRequest("Объект пуст."));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest("Объект не прошел валидацию."));
            }

            await _dataRepository.AddAsync(adresType);

            Log.Information("Adres type {@adresType} saved in database", adresType);

            /*  var message = new ItemCreatedIntegrationEvent("Item title", "Item description");
             * _eventBus.Publish(message);*/

            return(CreatedAtRoute("GetAdresType", new { Id = adresType.Id }, null));
        }