コード例 #1
0
        public ActionResult Create(IdentityProviderViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Create", model));
            }

            try
            {
                var idp = Mapper.Map <IdentityProvider>(model);
                _idpSvc.Add(idp);
                TempData["SuccessMessage"] = "New identity provider has been successfully added";
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
            }
            return(View("Create", model));
        }