public async Task <IActionResult> Edit(int id, [Bind("Fornecedor,Id,Documento,DescricaoDocumento,DataVencimento,ValorTotal,Situacao")] ContaAPagarViewModel contaAPagarViewModel) { if (id != contaAPagarViewModel.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(_mapper.Map <ContaAPagar>(contaAPagarViewModel)); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContaAPagarExists(contaAPagarViewModel.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(contaAPagarViewModel)); }
public async Task <IActionResult> Create([Bind("Fornecedor,Id,Documento,DescricaoDocumento,DataVencimento,ValorTotal,Situacao")] ContaAPagarViewModel contaAPagarViewModel) { if (ModelState.IsValid) { _context.Add(_mapper.Map <ContaAPagar>(contaAPagarViewModel)); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(contaAPagarViewModel)); }