Exemplo n.º 1
0
        public string AddPlayer(Player player)
        {
            contextDb.Add(player);
            contextDb.SaveChanges();

            return(player.Name);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Create(Motivo Motivo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(Motivo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(Motivo));
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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));
        }
Exemplo n.º 8
0
        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));
        }
Exemplo n.º 9
0
        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));
        }
Exemplo n.º 10
0
        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));
        }
Exemplo n.º 11
0
        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));
        }
Exemplo n.º 12
0
 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"));
 }