public static ContaBancaria ToModel(this ContaBancariaApi model) { return(new ContaBancaria { Id = model.Id, NomeBanco = model.NomeBanco, ValorConta = model.ValorConta, Rendimento = model.Rendimento, }); }
public async Task <ActionResult <ContaBancaria> > PostContaBancaria(ContaBancariaApi model) { if (ModelState.IsValid) { await _context.InsertAsync(model.ToModel()); return(Ok()); } return(BadRequest()); }
public async Task <IActionResult> PutContaBancaria(ContaBancariaApi model) { if (ModelState.IsValid) { var conta = model.ToModel(); await _context.UpdateChangesAsync(conta); return(Ok()); } return(BadRequest()); }