Example #1
0
        public ResponseModel UpdateMailSettings(MailSettings updObj)
        {
            ResponseModel result = new ResponseModel();

            result = ValidateUpdateMailSettings(updObj);

            if (!result.IsSuccess)
            {
                return(result);
            }

            bool value = _mailRepo.Update(updObj);

            result.IsSuccess = value;

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

            if (result.IsSuccess)
            {
                result.Message = "Bilgiler başarı ile güncellendi!";
            }
            StaticSettings.ReloadSettings();
            return(result);
        }
        public ActionResult Mail(FormCollection formCollection)
        {
            try
            {
                bool result = false;
                MailSettingRepository ml   = new MailSettingRepository();
                List <MailSetting>    list = ml.GetList(1, 20);
                MailSetting           obj  = new MailSetting();
                if (list.Count > 0)
                {
                    obj.LastUpdateDate = DateTime.Now;

                    obj.LastUpdateUserID = ID;

                    UpdateModel(obj);

                    result = ml.Update(obj) > 0 ? true : false;
                }
                else
                {
                    obj = new MailSetting()
                    {
                        CreateDate = DateTime.Now, CreateUserID = ID, IsDeleted = false
                    };

                    UpdateModel(obj);

                    result = ml.Insert(obj) > 0 ? true : false;
                }

                return(result ? Content(ContentIcon.Succeed + "|保存成功") : Content(ContentIcon.Error + "|保存失败"));
            }
            catch (Exception ex)
            {
                return(Content(ContentIcon.Error + "|" + ErrorWirter(RouteData, ex.Message)));
            }
        }