public IActionResult Index([FromForm] NewLetterEmail newLetter) { if (ModelState.IsValid) { _repositoryNewsletter.Cadastrar(newLetter); TempData["MSG_S"] = "E-mail cadastrado com sucesso"; return(RedirectToAction(nameof(Index))); } else { return(View()); } }
public void Cadastrar(NewLetterEmail newsletter) { _banco.NewLetterEmails.Add(newsletter); _banco.SaveChanges(); }