Example #1
0
        public async Task <IHttpActionResult> EliminarContacto(int id)
        {
            entRespuesta respuesta = new entRespuesta();

            try
            {
                var idUser  = JwtManager.getIdUserSession();
                var entidad = await _ir.Find <Contacto>(id);

                if (entidad != null && (entidad.idUsuario == idUser))
                {
                    entidad.vigente = false;
                    await _ir.Update(entidad, entidad.id);

                    respuesta.codigo  = 0;
                    respuesta.mensaje = "Contacto eliminado exitosamente";
                }
                else
                {
                    respuesta.codigo  = 0;
                    respuesta.mensaje = "Id de contacto no encontrado";
                }

                return(Ok(respuesta));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Example #2
0
        public async Task <IHttpActionResult> DesaHabilitarInscripcion(int id)
        {
            try
            {
                var          idUser    = JwtManager.getIdUserSession();
                entRespuesta respuesta = new entRespuesta();
                var          entidad   = await _ir.Find <IttIncripcionEvento>(id);//buscamos el registro a inhabilitar y actualizamos el estado

                if (entidad != null && (entidad.IdUsuario == idUser))
                {
                    entidad.vigente = false;
                    await _ir.Update(entidad, entidad.idInscripcionEvento);

                    respuesta.codigo  = 0;
                    respuesta.mensaje = "Inscripción evento Eliminada";
                }
                else
                {
                    respuesta.codigo  = 1;
                    respuesta.mensaje = "Inscripción evento no encontrada";
                }
                return(Ok(respuesta));
            }
            catch (Exception Ex)
            {
                return(BadRequest(Ex.Message));
            }
        }
        public async Task <IHttpActionResult> GuardaNotificacion(NotificacionViewModels notificacion)
        {
            entRespuesta respuesta = new entRespuesta();

            try
            {
                notificacion.idUsuario = JwtManager.getIdUserSession();
                var registro = await _ir.Find <Usuario>(notificacion.idUsuario);//buscamos al usuario por la id para guardar los datos de la notificacion

                if (registro != null)
                {
                    registro.numeroCelular         = notificacion.telefono;
                    registro.correoElectronico     = notificacion.email;
                    registro.habilitarNotificacion = notificacion.habilitado;
                    await _ir.Update(registro, registro.idUsuario);

                    respuesta.codigo  = 0;
                    respuesta.mensaje = "Notificación realizada";
                    return(Ok(respuesta));
                }
                else
                {
                    respuesta.codigo  = 1;
                    respuesta.mensaje = "Usuario no existente";
                    return(Ok(respuesta));
                }
            }
            catch (Exception ex)
            {
                respuesta.codigo  = 2;
                respuesta.mensaje = ex.Message;
                return(Ok(respuesta));
            }
        }
Example #4
0
        public async Task <IHttpActionResult> DesaHabilitarBranding(int id)
        {
            try
            {
                var          idUser    = JwtManager.getIdUserSession();
                entRespuesta respuesta = new entRespuesta();
                var          entidad   = await _ir.Find <IttBrandingDigital>(id);

                if (entidad != null && (entidad.IdUsuario == idUser))
                {
                    entidad.vigente = false;
                    await _ir.Update(entidad, entidad.idBranding);//aactualizamos el estado de vigencia

                    respuesta.codigo  = 0;
                    respuesta.mensaje = "Branding eliminado";
                }
                else
                {
                    respuesta.codigo  = 1;
                    respuesta.mensaje = "Branding no encontrado";
                }
                return(Ok(respuesta));
            }
            catch (Exception Ex)
            {
                return(BadRequest(Ex.Message));
            }
        }
        public async Task <IHttpActionResult> DeleteCoworking(int id)
        {
            entRespuesta respuesta = new entRespuesta();

            try
            {
                var idUser       = JwtManager.getIdUserSession();
                var agendamiento = await _ir.Find <Coworking>(id);              //buscamos el agendamiento

                if (agendamiento != null && (agendamiento.idUsuario == idUser)) //si no es null procedemos a dejarlo como no vigente y actualizamos
                {
                    agendamiento.vigente = false;
                    await _ir.Update(agendamiento, id);


                    respuesta.codigo  = 0;
                    respuesta.mensaje = "Coworking eliminado";
                    respuesta.data    = id;
                    return(Ok(respuesta));
                }
                else
                {
                    respuesta.codigo  = 1;
                    respuesta.mensaje = "No se ha podido encontrar Coworking";
                }
                return(Ok(respuesta));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public async Task <IHttpActionResult> FinalizarPrueba(int id)
        {
            entRespuesta respuesta = new entRespuesta();
            var          idUser    = JwtManager.getIdUserSession();

            try
            {
                var prueba = await _ir.Find <Prueba>(id);

                if (prueba != null && (prueba.idUsuario == idUser))
                {
                    prueba.completado = true;
                    await _ir.Update(prueba, id);

                    respuesta.codigo  = 0;
                    respuesta.mensaje = "Prueba Finalizada exitosamente";
                }
                else
                {
                    respuesta.codigo  = 1;
                    respuesta.mensaje = "Prueba no existente";
                }
            }
            catch (Exception ex)
            {
                respuesta.codigo  = 2;
                respuesta.mensaje = ex.Message;
            }
            return(Ok(respuesta));
        }