public async Task <IActionResult> Edit(int id, [Bind("Id,Nombre,Vocalistas,NumeroIntegrantes,AnioFormacion,FechaRegistro,Genero")] Banda banda)
        {
            if (id != banda.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(banda);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BandaExists(banda.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(banda));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Lugar,BandaId,Fecha")] ConciertoCreateViewModel vm)
        {
            if (id != vm.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var conciertoBd = await _servicioConciertos.CrearConcierto(vm, id);

                    _context.Update(conciertoBd);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConciertoExists(vm.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            vm.Bandas = ObtenerListaBandas();
            return(View(vm));
        }