コード例 #1
0
        public ActionResult AddClaimInline(ClaimModel model)
        {
            if (ModelState.IsValid)
            {
                Context.Claims.Add(new Claim
                {
                    Name = model.Name,
                    Scope = model.Scope
                });

                Context.SaveChanges();
            }

            return PartialView("_AddClaimInline", model);
        }
コード例 #2
0
        public ActionResult EditClaim(ClaimModel model)
        {
            if (ModelState.IsValid)
            {
                Claim claim;
                if (!Context.Claims.TryGetById(model.Id, out claim))
                    throw new InvalidOperationException(string.Format("claim with id {0} was not found", model.Id));

                claim.Name = model.Name;
                Context.SaveChanges();
            }

            return JsonView(ModelState.IsValid, "_EditClaim", model);
        }
コード例 #3
0
        public ActionResult EditClaim(long claimId)
        {
            Claim claim;
            if (!Context.Claims.TryGetById(claimId, out claim))
                throw new InvalidOperationException(string.Format("claim with id {0} was not found", claimId));

            var model = new ClaimModel
            {
                Id = claim.Id,
                Name = claim.Name,
                Scope = claim.Scope
            };

            return PartialView("_EditClaim", model);
        }