Exemple #1
0
        public async Task <IEnumerable <MEspecialidades> > ListarEspecialidades()
        {
            using (SqlConnection sql = new SqlConnection(_connectionString))
            {
                using (SqlCommand cmd = new SqlCommand("usp_ListarEspecialidades", sql))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    var response = new List <MEspecialidades>();
                    await sql.OpenAsync();

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