GetModulesByCompany() public méthode

public GetModulesByCompany ( int companyid ) : List
companyid int
Résultat List
        //
        public Company GetCompnay(int companyId)
        {
            Company company = null;
            using (var conn = new SqlConnection(PrescienceRxConnectionString))
            {
                conn.Open();

                using (var cmd = new SqlCommand(GetCompanyByIdSp, conn))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;

                    cmd.Parameters.Add("@CompanyId", System.Data.SqlDbType.Int);
                    cmd.Parameters["@CompanyId"].Value = companyId;

                    using (var myReader = cmd.ExecuteReader())
                    {
                        try
                        {
                            if (myReader.HasRows)
                            {
                                myReader.Read();
                                company = new Company(myReader);
                                AdminRepository admrep = new AdminRepository();
                                List<Module> modules = admrep.GetModulesByCompany(Convert.ToInt32(myReader["CompanyId"]));
                                company.LstModules = new List<int>();
                                foreach (var item in modules)
                                {
                                    company.LstModules.Add(item.ModuleId);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            // TODO Logg Error here
                        }
                    }
                }

            }
            return company;
        }
 //
 public List<Company> GetCompanies(string companyName)
 {
     var company = new List<Company>();
     AdminRepository admrep = new AdminRepository();
     using (var conn = new SqlConnection(PrescienceRxConnectionString))
     {
         conn.Open();
         using (var cmd = new SqlCommand(GetCompaniesSp, conn))
         {
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.Add("@Name", SqlDbType.VarChar);
             cmd.Parameters["@Name"].Value = companyName;
             using (var myReader = cmd.ExecuteReader())
             {
                 try
                 {
                     while (myReader.Read())
                     {
                         company.Add(new Company(myReader));
                         List<Module> modules = admrep.GetModulesByCompany(Convert.ToInt32(myReader["CompanyId"]));
                         company[company.Count - 1].LstModules = new List<int>();
                         foreach (var item in modules)
                         {
                             company[company.Count - 1].LstModules.Add(item.ModuleId);
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     // TODO Logg Error here
                 }
             }
         }
     }
     return company;
 }