public string AddPlayer(Player player) { contextDb.Add(player); contextDb.SaveChanges(); return(player.Name); }
public async Task <IActionResult> Create([Bind("Id,Nome,Email,Password,SetorId")] Usuario usuario) { if (ModelState.IsValid) { usuario.Cadastro = DateTime.Now.ToUniversalTime(); usuario.Ativo = true; _context.Add(usuario); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["SetorId"] = new SelectList(_context.Setor, "Id", "Descricao", usuario.SetorId); return(View(usuario)); }
public async Task <IActionResult> Create([Bind("Descricao")] Status Status) { if (ModelState.IsValid) { _context.Add(Status); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(Status)); }
public async Task <IActionResult> Create(Motivo Motivo) { if (ModelState.IsValid) { _context.Add(Motivo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(Motivo)); }
public async Task <IActionResult> Create([Bind("Nome")] Clube Clube) { if (ModelState.IsValid) { _context.Add(Clube); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(Clube)); }
public async Task <IActionResult> Create([Bind("JogadorId,Nome,Idade,Nacionalidade")] Jogador jogador) { if (ModelState.IsValid) { _context.Add(jogador); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(jogador)); }
public async Task <IActionResult> Create([Bind("ID,CustomerId,EmployeeId,ShipperId,OrderDate,RequiredDate,ShiedpDate,Freight,ShipName,ShipAddress,ShipCity,ShipRegion,ShipPostalCode,ShipCountry")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "ID", "ID", order.CustomerId); return(View(order)); }
public async Task <IActionResult> Create([Bind("Id,Descricao,ClienteId,UsuarioId")] Log log) { if (ModelState.IsValid) { _context.Add(log); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClienteId"] = new SelectList(_context.Cliente, "Id", "Id", log.ClienteId); return(View(log)); }
public async Task <IActionResult> Create(Cliente cliente) { if (ModelState.IsValid) { _context.Add(new Log { Cliente = cliente, Descricao = "Cadastrou", UsuarioId = UserId }); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ClubeId"] = new SelectList(_context.Clube, "Id", "Nome", cliente.ClubeId); ViewData["CampeonatoId"] = new SelectList(_context.Campeonato, "Id", "Description", cliente.CampeonatoId); ViewData["PagamentoId"] = new SelectList(_context.Pagamento, "Id", "Discription", cliente.PagamentoId); ViewData["MotivoId"] = new SelectList(_context.Motivo, "Id", "Description", cliente.MotivoId); ViewData["StatusId"] = new SelectList(_context.Status, "Id", "Descricao", cliente.StatusId); return(View(cliente)); }
public async Task <IActionResult> Create(Customer customer) { if (ModelState.IsValid) { customer.IsActive = true; _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Create([Bind("PlacarId,IdJogador,Pontos,Data")] Placar placar) { if (ModelState.IsValid) { _context.Add(placar); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IdJogador"] = new SelectList(_context.Jogadores, "JogadorId", "Nome", placar.IdJogador); return(View(placar)); }
public IActionResult Popular() { if (_context.Usuario.FirstOrDefault() != null) { return(RedirectToAction("Index", "Usuario")); } _context.Add(new Usuario { Ativo = true, Cadastro = DateTime.Now.ToUniversalTime(), Email = "*****@*****.**", Nome = "Joao Manoel", Password = "******", Setor = new Setor { Descricao = "Administrador" } }); _context.SaveChanges(); return(RedirectToAction("Index", "Usuario")); }