Ejemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            var claimType = m_claimTypeManager.FindClaimTypeById(id);

            if (claimType.HasError)
            {
                ModelState.AddModelError(claimType.Error.Message);
            }

            var claimTypeViewModel = m_mapper.Map <ClaimTypeViewModel>(claimType.Result);

            var viewModel = ViewModelBuilder.BuildClaimTypeViewModel(ModelState, claimTypeViewModel);

            return(View(viewModel));
        }
Ejemplo n.º 2
0
        public ActionResult View(int id)
        {
            var claimType = m_claimTypeManager.FindClaimTypeById(id);

            if (claimType.HasError)
            {
                ModelState.AddModelError(claimType.Error.Message);
            }

            var claimTypeViewModel = Mapper.Map <ClaimTypeViewModel>(claimType.Result);

            var viewModel = ViewModelBuilder.BuildClaimTypeViewModel(ModelState, claimTypeViewModel);

            var vm = ViewModelFactory.GetViewModel(viewModel,
                                                   Translator.Translate("delete-claim-type-confirm-dialog-title"),
                                                   Translator.Translate("delete-claim-type-confirm-dialog-message"));

            return(View(vm));
        }
Ejemplo n.º 3
0
        public ActionResult Create(ClaimTypeViewModel claimTypeViewModel)
        {
            if (ModelState.IsValid)
            {
                var claimTypeModel = m_mapper.Map <ClaimTypeModel>(claimTypeViewModel);

                var result = m_claimTypeManager.CreateClaimType(claimTypeModel);

                if (!result.HasError)
                {
                    return(RedirectToAction(nameof(View), new { id = result.Result }));
                }

                ModelState.AddModelError(result.Error.Message);
            }

            var viewModel = ViewModelBuilder.BuildClaimTypeViewModel(ModelState, claimTypeViewModel);

            return(View(viewModel));
        }
Ejemplo n.º 4
0
        public ActionResult Create()
        {
            var viewModel = ViewModelBuilder.BuildClaimTypeViewModel(ModelState);

            return(View(viewModel));
        }