Exemple #1
0
        public IActionResult SaveSmsSettings([FromBody] SmsSettingModel model)
        {
            if (ModelState.IsValid)
            {
                SmsSetting entity = new SmsSetting();

                model.CopyTo(entity);
                int            i      = 0;
                List <SmsBody> bodies = new List <SmsBody>();
                foreach (var item in model.Name)
                {
                    if (item.IsNotEmpty() && model.Content[i].IsNotEmpty())
                    {
                        bodies.Add(new SmsBody()
                        {
                            Name = item, Content = model.Content[i]
                        });
                    }
                    i++;
                }
                entity.Bodies = bodies;
                return(_settingService.Save(entity).SaveResult(T));
            }
            return(SaveFailure(GetModelErrors()));
        }
Exemple #2
0
        public IActionResult EditSmsSetting()
        {
            SmsSettingModel model    = new SmsSettingModel();
            var             settings = _settingFinder.Get <SmsSetting>();

            if (settings != null)
            {
                settings.CopyTo(model);
            }

            return(View(model));
        }