public async Task <ActionResult <Login> > Put(ActualizaIG a)
        {
            Login                l  = new Login();
            Paciente             p  = _pacienteService.Get(a.mail);
            VoluntarioBasico     vb = _voluntarioBasicoService.Get(a.mail);
            VoluntarioMedico     vm = _voluntarioMedicoService.Get(a.mail);
            VoluntarioAsociacion va = _voluntarioAsociacionService.Get(a.mail);

            if (p != null)
            {
                if (p.IdGoogle == null || p.IdGoogle.Equals("0"))
                {
                    p.IdGoogle = a.idGoogle;
                    _pacienteService.Update(p);
                }
                l.inicio = 1;
            }
            else if (vb != null)
            {
                if (vb.IdGoogle == null || vb.IdGoogle.Equals("0"))
                {
                    vb.IdGoogle = a.idGoogle;
                    _voluntarioBasicoService.Update(vb);
                }
                l.inicio = 1;
            }
            else if (vm != null)
            {
                if (vm.IdGoogle == null || vm.IdGoogle.Equals("0"))
                {
                    vm.IdGoogle = a.idGoogle;
                    _voluntarioMedicoService.Update(vm);
                }
                l.inicio = 1;
            }
            else if (va != null)
            {
                if (va.IdGoogle == null || va.IdGoogle.Equals("0"))
                {
                    va.IdGoogle = a.idGoogle;
                    _voluntarioAsociacionService.Update(va);
                }
                l.inicio = 1;
            }
            else
            {
                l.inicio = 0;
            }
            return(Ok(l));
        }
        public async Task <ActionResult> Add(VoluntarioAsociacion volAsociacion)
        {
            var p  = _pacienteService.Get(volAsociacion.Email);
            var vb = _voluntarioBasico.Get(volAsociacion.Email);
            var vm = _voluntarioMedico.Get(volAsociacion.Email);
            var va = _voluntarioAsociacionService.Get(volAsociacion.Email);

            if (p == null && vb == null && vm == null && va == null)
            {
                await _voluntarioAsociacionService.Add(volAsociacion);

                return(Ok(volAsociacion.Id));
            }
            else
            {
                return(Ok(null));
            }
        }
        public async Task <ActionResult <VolLogin> > Get(string correo)
        {
            VolLogin             v  = new VolLogin();
            Paciente             p  = _pacienteService.Get(correo);
            VoluntarioBasico     vb = _voluntarioBasicoService.Get(correo);
            VoluntarioMedico     vm = _voluntarioMedicoService.Get(correo);
            VoluntarioAsociacion va = _voluntarioAsociacionService.Get(correo);

            if (p != null)
            {
                v.idUser   = p.Id;
                v.tipoUser = p.TipoUsuarioId;
                return(Ok(v));
            }
            else if (vb != null)
            {
                v.idUser   = vb.Id;
                v.tipoUser = vb.TipoUsuarioId;
                return(Ok(v));
            }
            else if (vm != null)
            {
                v.idUser   = vm.Id;
                v.tipoUser = vm.TipoUsuarioId;
                return(Ok(v));
            }
            else if (va != null)
            {
                v.idUser   = va.Id;
                v.tipoUser = va.TipoUsuarioId;
                return(Ok(v));
            }
            else
            {
                return(Ok(null));
            }
        }
        public async Task <ActionResult <VoluntarioAsociacion> > Update(VoluntarioAsociacion va)
        {
            var volUpdateado = await _voluntarioAsociacionService.Update(va);

            return(Ok(volUpdateado));
        }
Exemple #5
0
 public async Task <VoluntarioAsociacion> Update(VoluntarioAsociacion va)
 {
     _context.VoluntarioAsociacion.Update(va);
     _context.SaveChanges();
     return(va);
 }
Exemple #6
0
        public async Task Add(VoluntarioAsociacion va)
        {
            await _context.VoluntarioAsociacion.AddAsync(va);

            _context.SaveChanges();
        }