Esempio n. 1
0
        public IActionResult EditLoadAddActivity(CaseLoadAddActivity model)
        {
            SetViewbagLoadAddActivity();
            if (!ModelState.IsValid)
            {
                return(View(nameof(EditLoadAddActivity), model));
            }

            string _isvalid = IsValidLoadAddActivity(model);

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

            var currentId = model.Id;

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