Exemple #1
0
        public IActionResult Update_old([FromBody] dto_Settings settings)
        {
            GenericResponse _res = new GenericResponse();

            _res.FillSuccess();
            if (settings != null)
            {
                if (ModelState.IsValid)
                {
                    dto_Settings _old = _service_Settings.Get(settings.ID);
                    _old.Conf_Value = settings.Conf_Value;
                    _service_Settings.update(_old);
                }
                else
                {
                    _res.FillError("model state is invalid");
                    _log.Error("model state is invalid");
                }
            }
            else
            {
                _res.FillError("setting is null");
                _log.Error("setting is null");
            }
            return(Ok(_res));
        }
Exemple #2
0
        public IActionResult Update([FromBody] List <dto_Settings> settings)
        {
            GenericResponse _res = new GenericResponse();

            _res.FillSuccess();
            if (settings != null && settings.Count > 0)
            {
                if (ModelState.IsValid)
                {
                    foreach (var item in settings)
                    {
                        dto_Settings _old = _service_Settings.Get(item.ID);
                        _old.Conf_Value = item.Conf_Value;
                        _service_Settings.update(_old);
                    }
                }
                else
                {
                    _res.FillError("model state is invalid");
                    _log.Error("model state is invalid");
                }
            }
            else
            {
                _res.FillError("setting is null");
                _log.Error("setting is null");
            }
            return(Ok(_res));
        }