public Domain.Entities.GlobalSetting.ContactInformation GetById(int id, bool isCache = true)
        {
            Domain.Entities.GlobalSetting.ContactInformation contactInformation;

            if (isCache)
            {
                var sbKey = new StringBuilder();
                sbKey.AppendFormat(CacheKey, "GetById");
                sbKey.Append(id);

                var key = sbKey.ToString();
                contactInformation = _cacheManager.Get <Domain.Entities.GlobalSetting.ContactInformation>(key);
                if (contactInformation == null)
                {
                    contactInformation = _contactInfoRepository.GetById(id);
                    _cacheManager.Put(key, contactInformation);
                }
            }
            else
            {
                contactInformation = _contactInfoRepository.GetById(id);
            }


            return(contactInformation);
        }
Exemple #2
0
        private async Task RefreshBinding()
        {
            var model = new ContactInfoModel(_contactInfoRepository.GetById(_bindingContext.Id.Value));

            await ClearBinding();
            await Bind(model);
        }
        //public IQueryable<ContactInfoViewModel> GetContactInfos()
        //{
        //    var contactInfos = _iContactInfoRepository.GetAll();
        //    var contactInfoViewModel = contactInfos.Select(EmContactInfo.SetToViewModel).ToList<ContactInfoViewModel>();
        //    return contactInfoViewModel.AsQueryable();
        //}

        public ContactInfoViewModel GetContactInfo(int id)
        {
            var contactInfo          = _iContactInfoRepository.GetById(id);
            var contactInfoViewModel = EmContactInfo.SetToViewModel(contactInfo);

            return(contactInfoViewModel);
        }
Exemple #4
0
 private async Task <ContactInfo> GetFromDb(Guid?id)
 {
     return(await Task.Run(() =>
     {
         if (!id.HasValue)
         {
             return null;
         }
         var entity = _contactInfoRepository.GetById(id.Value);
         Thread.Sleep(1000);
         return entity;
     }));
 }
Exemple #5
0
        public ContactInfo GetContactInfo(int id)
        {
            var contactInfo = _iContactInfoRepository.GetById(id);

            return(contactInfo);
        }