public async Task <IActionResult> Edit(int id, [Bind("id,idFormaPagamento")] PagamentoAnuncio pagamentoAnuncio) { if (id != pagamentoAnuncio.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pagamentoAnuncio); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PagamentoAnuncioExists(pagamentoAnuncio.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["idFormaPagamento"] = new SelectList(_context.FormaPagamento, "id", "tipoPagamento", pagamentoAnuncio.idFormaPagamento); return(View(pagamentoAnuncio)); }
public async Task <IActionResult> Create([Bind("id,idFormaPagamento")] PagamentoAnuncio pagamentoAnuncio) { if (ModelState.IsValid) { _context.Add(pagamentoAnuncio); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["idFormaPagamento"] = new SelectList(_context.FormaPagamento, "id", "tipoPagamento", pagamentoAnuncio.idFormaPagamento); return(View(pagamentoAnuncio)); }