Пример #1
0
        public async Task <IEnumerable <MPostulante> > ListarPostulante(MPostulante obj)
        {
            using (SqlConnection sql = new SqlConnection(_connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("usp_ListarPostulantes", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.Add(new SqlParameter("@CODSED", obj.CODSED));
                    cmd.Parameters.Add(new SqlParameter("@CODESP", obj.CODESP));
                    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);
                }
            }
        }