コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,NoCaja,Description")] Caja caja)
        {
            if (id != caja.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(caja);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CajaExists(caja.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(caja));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(string id, [Bind("Identificacion,Nombre,Apellido,Telefono,Correo,Direccion,TipoClienteId")] Cliente cliente)
        {
            if (id != cliente.Identificacion)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Update(cliente);
                    await db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.Identificacion))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TipoClienteId"] = new SelectList(db.TipoCliente, "Id", "Tipocliente", cliente.Id);
            return(View(cliente));
        }