Example #1
0
        public FeaturePermission CreateFeaturePermission(long subjectId, long featureId, PermissionType permissionType = PermissionType.Grant)
        {
            FeaturePermission featurePermission = new FeaturePermission()
            {
                Subject = SubjectsRepo.Get(subjectId),
                Feature = FeaturesRepo.Get(featureId),
                PermissionType = permissionType
            };

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<FeaturePermission> featuresRepo = uow.GetRepository<FeaturePermission>();
                featuresRepo.Put(featurePermission);

                uow.Commit();
            }

            return (featurePermission);
        }
Example #2
0
        public FeaturePermission UpdateFeaturePermission(FeaturePermission featurePermission)
        {
            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<FeaturePermission> usersRepo = uow.GetRepository<FeaturePermission>();
                usersRepo.Put(featurePermission);
                uow.Commit();
            }

            return (featurePermission);
        }