Пример #1
0
        public async Task <IActionResult> Edit(int id, Pedido pedido)
        {
            if (id != pedido.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pedido);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PedidoExists(pedido.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pedido));
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id, [Bind("CarrinhoId,IngressoId")] Carrinho carrinho)
        {
            if (id != carrinho.CarrinhoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(carrinho);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CarrinhoExists(carrinho.CarrinhoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IngressoId"] = new SelectList(_context.Set <Ingresso>(), "IngressoId", "IngressoId", carrinho.IngressoId);
            return(View(carrinho));
        }
Пример #3
0
        public async Task <Produto> Update(Produto produto, int setorId)
        {
            produto.Setor = await _context.Setor.FindAsync(setorId);

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

            return(produto);
        }
Пример #4
0
 public async void Update(Setor setor)
 {
     _context.Update(setor);
     await _context.SaveChangesAsync();
 }
Пример #5
0
 public async void Update(CarrinhoCompras carrinho)
 {
     _context.Update(carrinho);
     await _context.SaveChangesAsync();
 }