public async Task <IActionResult> SalvarInformacaoAsync(Table table, bool isPersistent) { string nome = Request.Cookies["Nome"]; string sobrenome = Request.Cookies["sobrenome"]; string email = Request.Cookies["Email"]; string data = Request.Cookies["Data"]; DateTime dataConverte = DateTime.Parse(data); ViewData["Message"] = new Table() { Nome = nome, Sobrenome = sobrenome, Email = email, DataNascimento = dataConverte, }; if (isPersistent == true) { _context.Add(ViewData["Message"]); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View()); }
public async Task <IActionResult> Create([Bind("Id,Nome,Sobrenome,Email,DataNascimento")] Table table) { if (ModelState.IsValid) { _context.Add(table); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(table)); }
public async Task <IActionResult> Create([Bind("Id,Nome,Sobrenome,Email,DataNascimento")] Table table, bool isPersistent) { if (ModelState.IsValid) { gCookie.Create(" Nome", "Sobrenome", "Email ", "data"); if (isPersistent) { _context.Add(table); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(RedirectToAction("SalvarInformacao")); } return(View(table)); }