public async Task <IActionResult> Edit(int id, [Bind("idIntegrante,numeroDocumento,primerNombre,segundoNombre,primerApellido,segundoApellido,fechaNacimiento,idTipoDocumento")] Integrantes integrantes)
        {
            if (id != integrantes.idIntegrante)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(integrantes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IntegrantesExists(integrantes.idIntegrante))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(integrantes));
        }
Beispiel #2
0
        public async Task <ActionResult <Integrantes> > PostIntegrantes(Integrantes integrantes)
        {
            _context.Integrante.Add(integrantes);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetIntegrantes", new { id = integrantes.idIntegrante }, integrantes));
        }
Beispiel #3
0
        public async Task <IActionResult> PutIntegrantes(int id, Integrantes integrantes)
        {
            if (id != integrantes.idIntegrante)
            {
                return(BadRequest());
            }

            _context.Entry(integrantes).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!IntegrantesExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #4
0
        public override void Validar()
        {
            StringBuilder errores = new StringBuilder();

            try
            {
                base.Validar();
            }
            catch (Exception ex)
            {
                errores.AppendLine(ex.Message + Constantes.SaldoLinea);
            }


            if (Integrantes == null)
            {
                errores.AppendLine("Debe ingresar los integrantes del equipo" + Constantes.SaldoLinea);
            }
            else
            {
                Integrantes.ToList <IntegranteEquipo>().ForEach(delegate(IntegranteEquipo integrante)
                {
                    string msjError = integrante.Validar();
                    if (msjError != string.Empty)
                    {
                        errores.AppendLine(msjError + Constantes.SaldoLinea);
                    }
                });
            }

            if (errores.Length != 0)
            {
                throw new ApplicationException(errores.ToString());
            }
        }
        public async Task <IActionResult> Create([Bind("idIntegrante,numeroDocumento,primerNombre,segundoNombre,primerApellido,segundoApellido,fechaNacimiento,idTipoDocumento")] Integrantes integrantes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(integrantes);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(integrantes));
        }
        public ActionResult CadastroDeMembrosEquipe(Integrantes integrantes, string id)
        {
            integrantes.TIMEID = timerepositorio.RetornaIdTime(id);
            integrantesrepositorio.CadastrarIntegrante(integrantes);
            var classe = integrantesrepositorio.CriarClasse();

            classe.NOME_JOGADORES  = "";
            classe.RG              = "";
            classe.DATA_NASCIMENTO = DateTime.Now;
            ViewBag.nome           = timerepositorio.RetornarNomeCapitao(id);
            ViewBag.lista          = timerepositorio.RetornarJogadoresTime(id);
            return(View(classe));
        }
Beispiel #7
0
        public virtual void AgregarIntegrante(IntegranteEquipo integranteAgregar)
        {
            Integrantes.ToList <IntegranteEquipo>().ForEach(delegate(IntegranteEquipo integrante)
            {
                if (integrante.Profesional == integranteAgregar.Profesional)
                {
                    throw new ApplicationException(string.Format("El profesional {0} ya es integrante del equipo {1}",
                                                                 integranteAgregar.Profesional.NombreCompleto,
                                                                 this.Descripcion));
                }
            });

            this.Integrantes.Add(integranteAgregar);
        }
        public IActionResult EliminarIntegrante(Integrantes integrantes)
        {
            bdvoleibolContext     context    = new bdvoleibolContext();
            IntegrantesRepository repository = new IntegrantesRepository(context);
            var integrante = repository.ObtenerPorId(integrantes.Id);

            if (integrante != null)
            {
                repository.Eliminar(integrante);
            }
            else
            {
                ModelState.AddModelError("", "El equipo a eliminar no existe.");
            }
            return(RedirectToAction("ListaDeIntegrantes", new { id = integrante.IdDt }));
        }
        public Time CadastrarTimes(Time time)
        {
            db.Time.Add(time);

            db.SaveChanges();
            var nome = (from a in db.Time where a.NOME_EQUIPE == time.NOME_EQUIPE select a).FirstOrDefault();

            integrantes = new Integrantes();
            integrantes.NOME_JOGADORES  = time.CAPITAO_DO_TIME;
            integrantes.RG              = time.RG_CAPITAO;
            integrantes.DATA_NASCIMENTO = time.DATA_NASCIMENTO_CAPITAO;
            integrantes.TIMEID          = nome.TIMEID;
            integrantes.CAPITAO         = true;
            db.Integrantes.Add(integrantes);
            db.SaveChanges();
            return(nome);
        }
        private void CarregarIntegrantes()
        {
            var integrantes = new List <Usuario>()
            {
                new Usuario()
                {
                    UsuarioId = Guid.NewGuid(), Nome = "Lucas", Email = "*****@*****.**", CriadoEm = DateTime.Now
                },
                new Usuario()
                {
                    UsuarioId = Guid.NewGuid(), Nome = "Mika", Email = "*****@*****.**", CriadoEm = DateTime.Now
                },
                new Usuario()
                {
                    UsuarioId = Guid.NewGuid(), Nome = "Lucas", Email = "*****@*****.**", CriadoEm = DateTime.Now
                }
            };

            integrantes.ForEach(i => Integrantes.Add(i));
        }
Beispiel #11
0
        public ActionResult VerBandaADM(Int32 ID)
        {
            if (Session["Administrador"] != null)
            {
                //CRIA SESSÃO DO Administrador
                ViewBag.Logado = Session["Administrador"];
                Usuario User = (Usuario)Session["Administrador"];
                ViewBag.User = User;
            }
            else
            {
                Response.Redirect("~/Acesso/Login");
            }

            Bandas             banda       = new Bandas(ID);
            List <Integrantes> integrantes = Integrantes.ListarIntegrantes(banda.ID);

            ViewBag.Integrantes = integrantes;
            ViewBag.Banda       = banda;

            return(View());
        }
Beispiel #12
0
        public IActionResult Create(Integrantes integrantes, Direccion direccion, DocumentoIdentificacion documento, DatosFamiliares familiares, DatosAcademicos academicos, DatosEclesiasticos eclesiasticos, DatosLaborales laborales, ImagesModel imgModel)
        {
            //Agregar tipo de Documento

            string wey = Request.Form["idc"];

            if (wey == "Cedula")
            {
                documento.TipoDocumento = "Cedula";
            }
            else if (wey == "RNC")
            {
                documento.TipoDocumento = "RNC";
            }
            else
            {
                documento.TipoDocumento = "Pasaporte";
            }



            bd.DatosFamiliares.Add(familiares);
            bd.SaveChanges();
            bd.DatosAcademicos.Add(academicos);
            bd.SaveChanges();
            bd.DatosEclesiasticos.Add(eclesiasticos);
            bd.SaveChanges();
            bd.DatosLaborales.Add(laborales);
            bd.SaveChanges();
            bd.Direccion.Add(direccion);
            bd.SaveChanges();


            //Adjuntar Documento

            string stringFileNameDoc = UploadFileDoc(imgModel);
            var    ss = new DocumentoIdentificacion
            {
                NombreDocumento = stringFileNameDoc
            };

            documento.NombreDocumento = stringFileNameDoc;

            bd.DocumentoIdentificacion.Add(documento);
            bd.SaveChanges();

            foreach (var direc in bd.Direccion)
            {
                integrantes.DireccionId = direc.DireccionId;
            }
            foreach (var fam in bd.DatosFamiliares)
            {
                integrantes.DatosFamiliaresId = fam.DatosFamiliaresId;
            }
            foreach (var aca in bd.DatosAcademicos)
            {
                integrantes.DatosAcademicosId = aca.DatosAcademicosId;
            }
            foreach (var ecle in bd.DatosEclesiasticos)
            {
                integrantes.DatosEclesiasticosId = ecle.DatosEclesiasticosId;
            }
            foreach (var doc in bd.DocumentoIdentificacion)
            {
                integrantes.DocIdentidadId = doc.DocIdentidadId;
            }
            foreach (var lab in bd.DatosLaborales)
            {
                integrantes.DatosLaboralesId = lab.DatosLaboralesId;
            }

            //Agregar Imagen
            string stringFileName = UploadFile(imgModel);
            var    integrante     = new Integrantes
            {
                Foto = stringFileName
            };


            integrantes.Foto = stringFileName;


            bd.Integrantes.Add(integrantes);
            bd.SaveChanges();

            return(RedirectToAction("Index"));
        }
Beispiel #13
0
        public async Task <IActionResult> Update(int id, Integrantes integrantes, Direccion direccion, DocumentoIdentificacion documento, DatosFamiliares familiares, DatosAcademicos academicos, DatosEclesiasticos eclesiasticos, DatosLaborales laborales, ImagesModel imgModel)
        {
            if (id != integrantes.IntegranteId)
            {
                return(NotFound());
            }

            //Adjuntar Documento

            string stringFileNameDoc = UploadFileDoc(imgModel);
            var    ss = new DocumentoIdentificacion
            {
                NombreDocumento = stringFileNameDoc
            };

            documento.NombreDocumento = stringFileNameDoc;

            foreach (var direc in bd.Direccion)
            {
                integrantes.DireccionId = direc.DireccionId;
            }
            foreach (var fam in bd.DatosFamiliares)
            {
                integrantes.DatosFamiliaresId = fam.DatosFamiliaresId;
            }
            foreach (var aca in bd.DatosAcademicos)
            {
                integrantes.DatosAcademicosId = aca.DatosAcademicosId;
            }
            foreach (var ecle in bd.DatosEclesiasticos)
            {
                integrantes.DatosEclesiasticosId = ecle.DatosEclesiasticosId;
            }
            foreach (var doc in bd.DocumentoIdentificacion)
            {
                integrantes.DocIdentidadId = doc.DocIdentidadId;
            }
            foreach (var lab in bd.DatosLaborales)
            {
                integrantes.DatosLaboralesId = lab.DatosLaboralesId;
            }

            bd.DatosFamiliares.Update(familiares);
            bd.Direccion.Update(direccion);
            await bd.SaveChangesAsync();

            bd.DocumentoIdentificacion.Update(documento);
            await bd.SaveChangesAsync();

            bd.DatosLaborales.Update(laborales);
            await bd.SaveChangesAsync();

            bd.DatosEclesiasticos.Update(eclesiasticos);
            await bd.SaveChangesAsync();

            bd.DatosAcademicos.Update(academicos);
            await bd.SaveChangesAsync();

            bd.Integrantes.Update(integrantes);
            await bd.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #14
0
 public void CadastrarIntegrante(Integrantes integrantes)
 {
     db.Integrantes.Add(integrantes);
     db.SaveChanges();
 }