Exemple #1
0
        public IActionResult Edit(CaseLoadIndex model)
        {
            SetViewbag(model.CaseId, model.CaseSessionId, model.IsMainActivity, model.DescriptionExpired != null);
            if (!ModelState.IsValid)
            {
                return(View(nameof(Edit), model));
            }

            string _isvalid = IsValid(model);

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

            var currentId = model.Id;
            var isCase    = model.DescriptionExpired != null;

            if (service.CaseLoadIndex_SaveData(model))
            {
                SetAuditContext(service, SourceTypeSelectVM.CaseLoadIndex, model.Id, currentId == 0);
                this.SaveLogOperation(currentId == 0, model.Id);
                SetSuccessMessage(MessageConstant.Values.SaveOK);
                return(RedirectToAction(nameof(Edit), new { id = model.Id, isFromCase = isCase }));
            }
            else
            {
                SetErrorMessage(MessageConstant.Values.SaveFailed);
            }
            return(View(nameof(Edit), model));
        }