Esempio n. 1
0
        public IActionResult EditElementTypeRule(CaseLoadElementTypeRule model)
        {
            SetViewbagElementTypeRule(model.CaseLoadElementTypeId);
            if (!ModelState.IsValid)
            {
                return(View(nameof(EditElementTypeRule), model));
            }

            string _isvalid = IsValidElementTypeRule(model);

            if (_isvalid != string.Empty)
            {
                SetErrorMessage(_isvalid);
                return(View(nameof(EditElementTypeRule), model));
            }

            var currentId = model.Id;

            if (service.CaseLoadElementTypeRule_SaveData(model))
            {
                this.SaveLogOperation(currentId == 0, model.Id);
                SetSuccessMessage(MessageConstant.Values.SaveOK);
                return(RedirectToAction(nameof(EditElementTypeRule), new { id = model.Id }));
            }
            else
            {
                SetErrorMessage(MessageConstant.Values.SaveFailed);
            }
            return(View(nameof(EditElementTypeRule), model));
        }