public ActionResult Save(string id, string descriptionResourceName, string name, string remark,
                                 string resourceId, int operators)
        {
            ResourceDescription resourceDescription = OrnamentContext.ResourceManager.Configuration()
                                                      .Get(descriptionResourceName);

            Permission permission;

            if (!string.IsNullOrEmpty(id))
            {
                permission = _memberShipFactory.CreatePermissionDao().Get(id);
            }
            else
            {
                permission = Permission.CreatePermission(resourceDescription.ValueType);
            }
            IResourceDao dao = _memberShipFactory.CreateResourceDao();

            permission.Name     = name;
            permission.Remark   = remark;
            permission.Resource = dao.GetResourceByStringId(resourceDescription.ValueType, resourceId);
            permission.Operator = operators;

            _memberShipFactory.CreatePermissionDao().SaveOrUpdate(permission);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
 public ResourceService(IResourceDao resourceDao, IAutomationService automationService, ICacheService cacheService)
 {
     _resourceDao = resourceDao;
     _automationService = automationService;
     _cacheService = cacheService;
 }
Esempio n. 3
0
 public ResourcesController(IResourceDao resourceDao)
 {
     _resourceDao = resourceDao;
 }