示例#1
0
        public ResponseModel UpdateSmsSettings(SmsSettings updObj)
        {
            ResponseModel result = new ResponseModel();
            bool          value  = _smsRepo.Update(updObj);

            if (updObj.RequiredIsRegister)
            {
                var mail_ = _mailRepo.GetAll().FirstOrDefault();
                mail_.ApproveSendMailNewUser = false;
                _mailRepo.Update(mail_);
            }

            result.IsSuccess = value;
            if (result.IsSuccess)
            {
                result.Message = "Bilgiler başarı ile güncellendi!";
            }
            StaticSettings.ReloadSettings();
            return(result);
        }
        public bool IsApproveSendMailNewUser()
        {
            var st = _mailRepo.GetAll().FirstOrDefault();

            return(st.ApproveSendMailNewUser);
        }
        public static void ReloadSettings()
        {
            SiteSettings = _siteRepo.GetAll().FirstOrDefault();
            MailSettings = _mailRepo.GetAll().FirstOrDefault();
            SmsSettings  = _smsRepo.GetAll().FirstOrDefault();
            LastComments = _commentRepo.GetByCustomQuery("select * from Comments where IsPublish = 1 order by ID desc", null).ToList();
            ContentViews = _contentRepo.GetPublishedViewList();
            Writers      = _userRepo.GetByCustomQuery("select * from Users where (select COUNT(*) from UserRoleRels ur where ur.RoleID = 2) > 0 and IsActive = 1 and IsApproved = 1", null).ToList();

            Categories = _catRepo.GetByCustomQuery("select * from Categories where IsActive = 1", null).ToList();

            StaticPages = _staticRepo.GetAll();

            MainPageSetting = _mainRepo.GetAll().FirstOrDefault();

            MainPageSliders = _sliderRepo.GetAll();

            if (LastComments == null)
            {
                LastComments = new List <Comments>();
            }

            if (SiteSettings == null)
            {
                SiteSettings = new SiteSettings();
            }
            if (MailSettings == null)
            {
                MailSettings = new MailSettings();
            }
            if (SmsSettings == null)
            {
                SmsSettings = new SmsSettings();
            }

            if (ContentViews == null)
            {
                ContentViews = new List <ContentViewListModel>();
            }

            if (Writers == null)
            {
                Writers = new List <Users>();
            }

            if (Categories == null)
            {
                Categories = new List <Categories>();
            }

            if (StaticPages == null)
            {
                StaticPages = new List <StaticPages>();
            }

            if (MainPageSetting == null)
            {
                MainPageSetting = new MainPageSettings();
            }

            if (MainPageSliders == null)
            {
                MainPageSliders = new List <MainSliderSettings>();
            }
        }