public async Task <IActionResult> Post(AddSexoRequest request) { var result = await _sexoService.AddSexoAsync(request); return(CreatedAtAction(nameof(GetById), new { sexoId = result.SexoId }, null)); }
public Sexo Map(AddSexoRequest request) { if (request == null) { return(null); } return(new Sexo { Descricao = request.Descricao }); }
public async Task <SexoResponse> AddSexoAsync(AddSexoRequest request) { var sexo = _sexoMapper.Map(request); var result = _sexoRepository.Add(sexo); var registrosModificados = await _sexoRepository .UnitOfWork.SaveChangesAsync(); _logger.LogInformation( Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, registrosModificados); _logger.LogInformation( Events.Add, Messages.ChangesApplied_id, result?.SexoId); return(_sexoMapper.Map(result)); }