public IEnumerable<Address> GetUserAddresses(int userId) { const string commandText = @"Select chz_address_id, chz_addresses.sys_id,text From chz_addresses Inner Join chz_companies On chz_addresses.chz_company_id=chz_companies.chz_company_id Inner Join doctors On doctors.chz_company_id=chz_companies.chz_company_id Where doctor_id=@doctor_id"; var parameter = new Doctor.IdParameter() { Id = userId }; var transaction = Transact<Address>.Create(ConnectionString, commandText, parameter: parameter); return transaction.ExecuteReader(); }
public Company GetUserCompany(int userId) { const string commandText = @"Select chz_companies.chz_company_id, chz_companies.inn,name From doctors Inner Join chz_companies On doctors.chz_company_id=chz_companies.chz_company_id where doctor_id = @doctor_id" ; var parameter = new Doctor.IdParameter() { Id = userId }; var transaction = Transact <Company> .Create(ConnectionString, commandText, parameter : parameter); return(transaction.ExecuteReader().FirstOrDefault()); }