Beispiel #1
0
        private InstitutionEditViewModel DataInstitution(int institutionId, string isAssigned)
        {
            InstitutionPermission();
            var model = _viewModelMapperHelper.GetInstitutionEdit(institutionId).InstitutionEdit;

            // TODO: It's saving info in the ViewBag that already exist in the model.
            // Use the model directly.
            ViewBag.Mode                = model.InstitutionId > 0 ? "EDIT" : "NEW";
            ViewBag.State               = model.ValidationStage;
            ViewBag.EditablaInst        = !model.IsInactive && isAssigned != "YES";
            ViewBag.ID                  = institutionId;
            ViewBag.SerializedViewModel = PageSerializationHelper.SerializeObject(model);
            ViewBag.CountryFilter       = _viewModelMapperHelper
                                          .GetListMasterData(COUNTRY_ASSOCIATED, true);
            ViewBag.TypeFilter = _viewModelMapperHelper.GetListMasterData(TYPE, true);

            if (institutionId > 0 && model.ValidationStage == null)
            {
                model.ErrorMessage = Localization.GetText("Institution.Deleted");
            }

            return(model);
        }