public async Task <IActionResult> Edit(int id, [Bind("Id_Plano,Nome_Plano,Valor_Plano,Qtde_Max_Dispositivos_Plano")] Plano plano) { if (id != plano.Id_Plano) { return(NotFound()); } if (ModelState.IsValid) { try { plano.Data_Cadastro_Plano = DateTime.Now; _context.Update(plano); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlanoExists(plano.Id_Plano)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(plano)); }
public async Task <IActionResult> Create([Bind("Id_Plano,Nome_Plano,Valor_Plano,Qtde_Max_Dispositivos_Plano")] Plano plano) { if (ModelState.IsValid) { plano.Data_Cadastro_Plano = DateTime.Now; _context.Add(plano); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(plano)); }