コード例 #1
0
        public Country GetCountry(CountryKey key)
        {
            Country country  = null;
            string  cacheKey = key == null ? "CountryKey_null" : key.GetCacheKey();

            if (key != null && !TryGetCacheData(cacheKey, out country, _cacheName))
            {
                country = GetCountryManager().GetCountry(key);
                SetCacheData(_cacheName, cacheKey, country);
            }
            return(country);
        }
コード例 #2
0
        /// <summary>
        /// Delete data in database
        /// </summary>
        /// <param name="key">Primary Key</param>
        public void Delete(CountryKey key)
        {
            if (key == null || key.Id == 0)
            {
                return;
            }

            var row = _dbContext.Table <CountryRow>().Where(m => m.Id == key.Id).FirstOrDefault();

            if (row != null)
            {
                _dbContext.Delete(row);
            }
        }
コード例 #3
0
        /// <summary>
        /// Get data in database
        /// </summary>
        /// <param name="key">Primary Key</param>
        /// <returns>read data</returns>
        public Country Get(CountryKey key)
        {
            if (key == null || key.Id == 0)
            {
                return(null);
            }

            var row = _dbContext.Table <CountryRow>().Where(m => m.Id == key.Id).FirstOrDefault();

            if (row != null)
            {
                return(CountryTransformer.ToBean(row));
            }
            return(null);
        }
コード例 #4
0
        /// <summary>
        /// Delete data in database
        /// </summary>
        /// <param name="key">Primary Key</param>
        public void Delete(CountryKey key)
        {
            if (key == null || key.Id == 0)
            {
                return;
            }

            var row = _dbContext.Country.Where(m => m.Id == key.Id).FirstOrDefault();

            if (row != null)
            {
                _dbContext.Country.Remove(row);
                _dbContext.SaveChanges();
            }
        }
コード例 #5
0
ファイル: CountryManager.cs プロジェクト: NitrofCG/BodyReport
 internal Country GetCountry(CountryKey key)
 {
     return(_module.Get(key));
 }
コード例 #6
0
 public Country GetCountry(CountryKey key)
 {
     return(_module.Get(key));
 }