Example #1
0
        public async Task RegistrarAsistencia(MPostulante obj)
        {
            using (SqlConnection sql = new SqlConnection(_connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("usp_RegistrarAsistencia", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@Id_postulante", obj.Id_postulante));


                    try
                    {
                        await sql.OpenAsync();

                        await cmd.ExecuteNonQueryAsync();

                        return;
                    }
                    catch (Exception e)
                    {
                        return;
                    }
                }
            }
        }
        public async Task <ActionResult <IEnumerable <MPostulante> > > listar(string codsed, string codesp)
        {
            MPostulante obj = new MPostulante();

            obj.CODSED = codsed;
            obj.CODESP = codesp;
            return((await _repository.ListarPostulante(obj)).ToList());
        }
        public async Task <IActionResult> Registrar(MPostulante obj)
        {
            var resut = (await _repository.ConsultarPostulante(obj)).ToList();

            try
            {
                await _repository.RegistrarAsistencia(resut[0]);

                return(Ok());
            }
            catch (Exception e)
            {
                _logger.LogError(e, e.Message);
                return(StatusCode(500, e));
            }
        }
Example #4
0
        public async Task <IEnumerable <MPostulante> > ConsultarPostulante(MPostulante obj)
        {
            using (SqlConnection sql = new SqlConnection(_connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("usp_ConsultarPostulante", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@NUMDOC", obj.NUMDOC));
                    var response = new List <MPostulante>();
                    await sql.OpenAsync();

                    using (var reader = await cmd.ExecuteReaderAsync())
                    {
                        while (await reader.ReadAsync())
                        {
                            response.Add(_populate.SetPostulante(reader));
                        }
                    }
                    return(response);
                }
            }
        }