コード例 #1
0
 public async Task <IActionResult> Edit([Bind("ID,UsuarioId,Data")] Pedido pedido)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(pedido);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!PedidoExists(pedido.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["UsuarioId"] = new SelectList(_context.Usuarios, "ID", "ID", pedido.UsuarioId);
     return(View(pedido));
 }
コード例 #2
0
        public async Task <IActionResult> JogarPedido([Bind("tipoProdutoId,nome,qtd")] TipoProduto tipoProduto)
        {
            Confeccao confeccao = new Confeccao(tipoProduto);

            _context.Update(confeccao);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
コード例 #3
0
        public async Task <IActionResult> Pedir([Bind("RoupaId,Nome,Quantidade")] Roupa roupa)
        {
            Pedido pedido = new Pedido(roupa);

            _context.Update(pedido);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
コード例 #4
0
ファイル: ConfeccaoController.cs プロジェクト: vovj11/loja
        public async Task <IActionResult> Edit(int id, [Bind("confeccaoId,tipoProdutoId,data")] Confeccao confeccao)
        {
            if (id != confeccao.confeccaoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(confeccao);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConfeccaoExists(confeccao.confeccaoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["tipoProdutoId"] = new SelectList(_context.Set <TipoProduto>(), "tipoProdutoId", "tipoProdutoId", confeccao.tipoProdutoId);
            return(View(confeccao));
        }
コード例 #5
0
 public ActionResult Edit(int id, [Bind("Id,Nome")] Departamento departamento)
 {
     //verifico se o id é o mesmo que tenho no banco
     if (id != departamento.Id)
     {
         return(NotFound());
     }
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(departamento);
             _context.SaveChanges();
             return(RedirectToAction(nameof(Index)));
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!DepartamentoExists(departamento.Id))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
     }
     return(View(departamento));
 }
コード例 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CdCl,DsNome,IdTipo,CdVend,DsLim")] Clientes clientes)
        {
            if (id != clientes.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clientes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClientesExists(clientes.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clientes));
        }
コード例 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("IdLoja,CNPJ,Nome_Completo")] Loja loja)
        {
            if (id != loja.IdLoja)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(loja);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LojaExists(loja.IdLoja))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(loja));
        }
コード例 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Nome,Cpf,Email")] Usuario usuario)
        {
            if (id != usuario.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(usuario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsuarioExists(usuario.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(usuario));
        }
コード例 #9
0
        public async Task <IActionResult> Edit(int id, [Bind("EnrollmentID,VendedoresID,ClientesID")] Enrollment enrollment)
        {
            if (id != enrollment.EnrollmentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(enrollment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnrollmentExists(enrollment.EnrollmentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientesID"]   = new SelectList(_context.Clientes, "Id", "Id", enrollment.ClientesID);
            ViewData["VendedoresID"] = new SelectList(_context.Vendedores, "Id", "Id", enrollment.VendedoresID);
            return(View(enrollment));
        }
コード例 #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Preco")] Produto produto)
        {
            if (id != produto.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(produto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProdutoExists(produto.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(produto));
        }
コード例 #11
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,CdVend,DsNome,CdTab,DtNasc")] Vendedores vendedores)
        {
            if (id != vendedores.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(vendedores);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VendedoresExists(vendedores.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(vendedores));
        }
コード例 #12
0
        public async Task <IActionResult> Edit(int id, [Bind("PedidoId,RoupaId,Data")] Pedido pedido)
        {
            if (id != pedido.PedidoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pedido);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PedidoExists(pedido.PedidoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoupaId"] = new SelectList(_context.Set <Roupa>(), "RoupaId", "RoupaId", pedido.RoupaId);
            return(View(pedido));
        }
コード例 #13
0
 public void Atualizar(Categoria categoria)
 {
     _banco.Update(categoria);
     _banco.SaveChanges();
 }
コード例 #14
0
 public void Atualizar(Cliente cliente)
 {
     _banco.Update(cliente);
     _banco.SaveChanges();
 }
コード例 #15
0
 public void Atualizar(Colaborador colaborador)
 {
     _banco.Update(colaborador);
     _banco.Entry(colaborador).Property(a => a.Senha).IsModified = false;
     _banco.SaveChanges();
 }