예제 #1
0
        public IActionResult Update(short id)
        {
            var policy = _authorizationPolicyService.Find(id);
            var model  = new AuthorizationPolicyModel
            {
                CreatedById   = policy.CreatedById,
                CreatedDate   = policy.CreatedDate,
                CreatedByName = policy.CreatedByName,
                UpdatedById   = policy.UpdatedById,
                UpdatedDate   = policy.CreatedDate,
                UpdatedByName = policy.CreatedByName,
                Description   = policy.Description,
                Id            = policy.Id,
                Name          = policy.Name
            };

            var permissionMethod = EnumUtil.FilterEnumByName <PolicyMethod>(model.Name);

            model.SelectPermissionMethods = EnumUtil.ToSelectOptions(permissionMethod).Select(x => new SelectListItem
            {
                Selected = x.IsSelected,
                Value    = x.Id,
                Text     = x.Text
            });
            model.PermissionMethod = (int)permissionMethod;
            var permissionMethodName = permissionMethod.ToString();

            model.Name = model.Name.Replace(permissionMethodName, "");

            return(View(model));
        }