Beispiel #1
0
        public HkoSifreDTO GetHkoSifreByID(string hkoSifra)
        {
            ISqlGenerator <HkoSifre> sqlGenerator = new SqlGenerator <HkoSifre>();

            try
            {
                // Create repository instance
                HkoSifreRepository repository = new HkoSifreRepository(SqlCon, sqlGenerator);

                // Call repository method
                var items = HkoSifreHandler.MapHkoSifreToDtO(repository.GetAll("HKO.s_hko_sifre"));

                // Get sector if hkoSifra is for sector
                var response = items.FirstOrDefault(x => x.ID == hkoSifra);

                // Get sub-sector if hkoSifra is for sub-sector
                if (response == null)
                {
                    response = items.SelectMany(x => x.Podsektori).First(y => y.ID == hkoSifra);
                }

                return(response);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #2
0
        public IList <HkoSifreDTO> GetHkoSifre()
        {
            ISqlGenerator <HkoSifre> sqlGenerator = new SqlGenerator <HkoSifre>();

            try
            {
                // Create repository instance
                HkoSifreRepository repository = new HkoSifreRepository(SqlCon, sqlGenerator);

                // Call repository method
                var items = repository.GetAll("HKO.s_hko_sifre");

                return(HkoSifreHandler.MapHkoSifreToDtO(items));
            }
            catch (Exception ex)
            {
                throw;
            }
        }