public async Task <IActionResult> Criar([Bind("ID,Descricao,Localizacao")] Sessao sessao) { if (ModelState.IsValid) { _context.Add(sessao); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Listar))); } return(View(sessao)); }
public async Task <IActionResult> Criar([Bind("CPF,Nome,Tel")] Cliente cliente) { if (ModelState.IsValid) { _context.Add(cliente); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Listar))); } return(View(cliente)); }
public async Task <IActionResult> Criar([Bind("CodigoVideo,Titulo,Disponibilidade,QuantidadeEstoque,Genero")] Video video) { if (ModelState.IsValid) { _context.Add(video); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Listar))); } return(View(video)); }
public async Task <IActionResult> Criar([Bind("ID,AtorPrincipal")] Ator ator) { if (ModelState.IsValid) { _context.Add(ator); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Listar))); } return(View(ator)); }
public async Task <IActionResult> Criar([Bind("ID")] DVD dVD) { if (ModelState.IsValid) { _context.Add(dVD); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Listar))); } return(View(dVD)); }
public async Task <IActionResult> Criar([Bind("CodigoLocacao,DataLocacao,DataDevolucao,Valor,Cliente")] Locacao locacao, IFormCollection collection) { int cpfCliente = Convert.ToInt16(collection["Cliente"]); if (ModelState.IsValid) { var cliente = await _context.Cliente.FindAsync(cpfCliente); locacao.Cliente = cliente; _context.Add(locacao); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Listar))); } return(View(locacao)); }