Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("CourseID,Name")] Course course)
        {
            if (ModelState.IsValid)
            {
                _context.Add(course);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(course));
        }
        public async Task <IActionResult> Create([Bind("Id,Apelido,Email")] Usuario usuario)
        {
            if (ModelState.IsValid)
            {
                _context.Add(usuario);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(usuario));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("StudentID,Name")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("EstadoId,Nome,Uf")] Estado estado)
        {
            if (ModelState.IsValid)
            {
                _context.Add(estado);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(estado));
        }
Esempio n. 5
0
        public async Task <IActionResult> Create([Bind("ClienteId,Nome,Cpf,Telefone,Referencia")] Cliente cliente)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cliente);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cliente));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create([Bind("EnderecoId,Rua,NumeroDaCasa,Bairro,Cep")] Endereco endereco)
        {
            if (ModelState.IsValid)
            {
                _context.Add(endereco);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(endereco));
        }
Esempio n. 7
0
        public async Task <IActionResult> Create([Bind("Id")] Review review)
        {
            if (ModelState.IsValid)
            {
                _context.Add(review);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(review));
        }
Esempio n. 8
0
        public IActionResult Edite(User userChanges)
        {
            var currentUser = db.Users.Where(u => u.Id == currentUserId).Last();

            currentUser.FirstName = userChanges.FirstName;
            currentUser.LastName  = userChanges.LastName;
            currentUser.Email     = userChanges.Email;

            db.Users.Update(currentUser);
            db.SaveChangesAsync();

            var user = db.Users.Where(us => us.Id == currentUser.Id);

            return(RedirectToAction("Index"));
        }
Esempio n. 9
0
        public async Task CreateAsync(TipoUsuario tu)
        {
            tu.Ativo = true;
            await _context.TipoUsuarios.AddAsync(tu);

            await _context.SaveChangesAsync();
        }
        public async Task CreateAsync(Plataforma plataforma)
        {
            await _context.Plataformas.AddAsync(plataforma);

            await _context.SaveChangesAsync();
        }
        public async Task CreateAsync(Desenvolvedora desenvolvedora)
        {
            await _context.Desenvolvedoras.AddAsync(desenvolvedora);

            await _context.SaveChangesAsync();
        }
        public async Task CreateAsync(Diretor diretor)
        {
            await _context.Diretores.AddAsync(diretor);

            await _context.SaveChangesAsync();
        }
Esempio n. 13
0
        public async Task <IActionResult> CreateCanton(VirtualCanton virtualCanton)
        {
            virtualCanton.Id = db.VirtualCantons.Count() + (new Random()).Next(10, 100000);
            db.Entry(virtualCanton).State = EntityState.Added;
            db.VirtualCantons.Add(virtualCanton);
            await db.SaveChangesAsync();

            return(RedirectToAction("Canton"));
        }
Esempio n. 14
0
 public IActionResult Create(VirtualCanton virtualCanton)
 {
     db.VirtualCantons.Add(virtualCanton);
     db.SaveChangesAsync();
     return(RedirectToAction("Privacy"));
 }
Esempio n. 15
0
 public virtual async Task CommitAsync()
 {
     await _context.SaveChangesAsync();
 }
        public async Task CreateAsync(Genero genero)
        {
            await _context.Generos.AddAsync(genero);

            await _context.SaveChangesAsync();
        }
Esempio n. 17
0
 public IActionResult Create(VirtualDistrict virtualDistrict)
 {
     db.VirtualDistricts.Add(virtualDistrict);
     db.SaveChangesAsync();
     return(RedirectToAction("Privacy"));
 }
Esempio n. 18
0
        public async Task CreateAsync(Classificacao classificacao)
        {
            await _context.Classificacoes.AddAsync(classificacao);

            await _context.SaveChangesAsync();
        }
Esempio n. 19
0
 public async Task CommitAsync()
 {
     await _aplicationContext.SaveChangesAsync();
 }
Esempio n. 20
0
        public async Task CreateAsync(ModoJogo modoJogo)
        {
            await _context.ModoJogos.AddAsync(modoJogo);

            await _context.SaveChangesAsync();
        }