public async Task <IActionResult> Edit(int id, [Bind("Id,FechaCreacion,PropietarioId,Estado")] Mercado mercado)
        {
            if (id != mercado.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mercado);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MercadoExists(mercado.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PropietarioId"] = new SelectList(_context.Propietario, "Id", "Id", mercado.PropietarioId);
            return(View(mercado));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,contenido,UnidadMedida,Estado")] Producto producto)
        {
            if (id != producto.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(producto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductoExists(producto.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(producto));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Estado,PaisID")] Departamento departamento)
        {
            if (id != departamento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(departamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartamentoExists(departamento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PaisID"] = new SelectList(_context.Pais, "Id", "Id", departamento.PaisID);
            return(View(departamento));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Numero,Piso,Bloque,UnidadResidencialId,Estado")] Apartamento apartamento)
        {
            if (id != apartamento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(apartamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApartamentoExists(apartamento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UnidadResidencialId"] = new SelectList(_context.UnidadResidencial, "Id", "Id", apartamento.UnidadResidencialId);
            return(View(apartamento));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,MercadoId,ProductoId,Cantidad")] Compra compra)
        {
            if (id != compra.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(compra);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompraExists(compra.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MercadoId"]  = new SelectList(_context.Mercado, "Id", "Id", compra.MercadoId);
            ViewData["ProductoId"] = new SelectList(_context.Producto, "Id", "Id", compra.ProductoId);
            return(View(compra));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Apellido,Telefono,ApartamentoID")] Propietario propietario)
        {
            if (id != propietario.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(propietario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PropietarioExists(propietario.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ApartamentoID"] = new SelectList(_context.Apartamento, "Id", "Id", propietario.ApartamentoID);
            return(View(propietario));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Direccion,Telefono,CiudadID,Estado")] UnidadResidencial unidadResidencial)
        {
            if (id != unidadResidencial.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(unidadResidencial);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UnidadResidencialExists(unidadResidencial.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CiudadID"] = new SelectList(_context.Ciudad, "Id", "Id", unidadResidencial.CiudadID);
            return(View(unidadResidencial));
        }