0
I have in my Repositorygenerico the methods :
public virtual async Task Adicionar(TEntity entity)
{
DbSet.Add(entity);
await SaveChanges();
}
public async Task<int> SaveChanges()
{
return await Db.SaveChangesAsync();
}
The Savechanges method makes the recorded ID return, as I could catch this return?
Example in controller:
[Route("Fornecedores/criar-novo-fornecedor")]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(FornecedorViewModel fornecedorViewModel)
{
var dados = _mapper.Map<Fornecedor>(fornecedorViewModel);
await _fornecedorRepository.Adicionar(dados);
}
Ok... I edit the above answer or create a new one ?
– user21727