コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ForoId,PropuestaId")] Foro foro)
        {
            if (id != foro.ForoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(foro);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ForoExists(foro.ForoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PropuestaId"] = new SelectList(_context.Propuesta, "PropuestaId", "Titulo", foro.PropuestaId);
            return(View(foro));
        }
コード例 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("UsuarioDepartamentoId,UsuarioId,DepartamentoId")] UsuarioDepartamento usuarioDepartamento)
        {
            if (id != usuarioDepartamento.UsuarioDepartamentoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(usuarioDepartamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsuarioDepartamentoExists(usuarioDepartamento.UsuarioDepartamentoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartamentoId"] = new SelectList(_context.Departamento, "DepartamentoId", "Nombre", usuarioDepartamento.DepartamentoId);
            ViewData["UsuarioId"]      = new SelectList(_context.AspNetUsers, "Id", "Id", usuarioDepartamento.UsuarioId);
            return(View(usuarioDepartamento));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(int id, [Bind("PropuestaDepartamentoId,PropuestaId,DepartamentoId")] PropuestaDepartamento propuestaDepartamento)
        {
            if (id != propuestaDepartamento.PropuestaDepartamentoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(propuestaDepartamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PropuestaDepartamentoExists(propuestaDepartamento.PropuestaDepartamentoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DepartamentoId"] = new SelectList(_context.Departamento, "DepartamentoId", "Nombre", propuestaDepartamento.DepartamentoId);
            ViewData["PropuestaId"]    = new SelectList(_context.Propuesta, "PropuestaId", "Titulo", propuestaDepartamento.PropuestaId);
            return(View(propuestaDepartamento));
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("DepartamentoId,Nombre")] Departamento departamento)
        {
            if (id != departamento.DepartamentoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(departamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartamentoExists(departamento.DepartamentoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(departamento));
        }
コード例 #5
0
        public async Task <IActionResult> Edit(string id, [Bind("UserId,RoleId")] AspNetUserRoles aspNetUserRoles)
        {
            if (id != aspNetUserRoles.UserId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aspNetUserRoles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AspNetUserRolesExists(aspNetUserRoles.UserId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RoleId"] = new SelectList(_context.AspNetRoles, "Id", "Id", aspNetUserRoles.RoleId);
            ViewData["UserId"] = new SelectList(_context.AspNetUsers, "Id", "Id", aspNetUserRoles.UserId);
            return(View(aspNetUserRoles));
        }
コード例 #6
0
        public async Task <IActionResult> Edit(int id, [Bind("VotoPropuestaId,PropuestaId,Votacion,UsuarioId,Comentario")] VotoPropuesta votoPropuesta)
        {
            if (id != votoPropuesta.VotoPropuestaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(votoPropuesta);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VotoPropuestaExists(votoPropuesta.VotoPropuestaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PropuestaId"] = new SelectList(_context.Propuesta, "PropuestaId", "Titulo", votoPropuesta.PropuestaId);
            ViewData["UsuarioId"]   = new SelectList(_context.AspNetUsers, "Id", "UserName", votoPropuesta.UsuarioId);
            return(View(votoPropuesta));
        }
コード例 #7
0
        public async Task <IActionResult> Edit(int id, [Bind("PropuestaId,Titulo,Descripcion,Pendiente,Tipo,UsuarioId,FechaPublicacion,FechaFinalizacion,Problema,ResultadoEsperado,Riesgos,Beneficios")] Propuesta propuesta)
        {
            if (id != propuesta.PropuestaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(propuesta);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PropuestaExists(propuesta.PropuestaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UsuarioId"] = new SelectList(_context.AspNetUsers, "Id", "UserName", propuesta.UsuarioId);
            return(View(propuesta));
        }
コード例 #8
0
        public async Task <IActionResult> Edit(int id, [Bind("NoticiaId,UsuarioId,Descripcion")] Noticia noticia)
        {
            if (id != noticia.NoticiaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(noticia);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NoticiaExists(noticia.NoticiaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UsuarioId"] = new SelectList(_context.AspNetUsers, "Id", "UserName", noticia.UsuarioId);
            return(View(noticia));
        }
コード例 #9
0
        public async Task <IActionResult> Edit(int id, [Bind("ForoId,UsuarioId,Comentario1,ComentarioId")] Comentario comentario)
        {
            if (id != comentario.ComentarioId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(comentario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ComentarioExists(comentario.ComentarioId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ForoId"]    = new SelectList(_context.Foro, "ForoId", "ForoId", comentario.ForoId);
            ViewData["UsuarioId"] = new SelectList(_context.AspNetUsers, "Id", "UserName", comentario.UsuarioId);
            return(View(comentario));
        }