Exemplo n.º 1
0
 /// <summary>
 /// Get Permission Roles
 /// </summary>
 /// <param name="roleId"></param>
 /// <returns></returns>
 public List <PermissionRole> GetPermissionRoles(string roleId)
 {
     try
     {
         var data = new List <PermissionRole>();
         var list = this.Permissions.Where(s => s.PermissionRoles.Any(u => u.RoleId.Equals(roleId))).ToList();
         foreach (var item in list)
         {
             var model = new PermissionRole
             {
                 PermissionId = item.Id,
                 RoleId       = roleId
             };
             data.Add(model);
         }
         //List<PermissionRole> data = (from g in this.Permissions where g.PermissionRoles.Any(u => u.RoleId == roleId) select new PermissionRole {
         //    PermissionId = g.Id, RoleId = roleId
         //}).ToList();
         return(data);
     }
     catch (Exception ex)
     {
         throw ex.GetBaseException();
     }
 }
 public virtual void Update(PermissionRole entity)
 {
     if (entity != null)
     {
         this.Context.Entry <PermissionRole>(entity).State = EntityState.Modified;
     }
 }
 public virtual async Task DeleteAsync(PermissionRole obj)
 {
     this.ThrowIfDisposed();
     if (obj == null)
     {
         throw new ArgumentNullException(nameof(obj));
     }
     this._permissionRoleStore.Delete(obj);
     await this.Context.SaveChangesAsync();
 }
 public virtual void Create(PermissionRole obj)
 {
     this.ThrowIfDisposed();
     if (obj == null)
     {
         throw new ArgumentNullException(nameof(obj));
     }
     this._permissionRoleStore.Create(obj);
     this.Context.SaveChanges();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Create new Permission Role
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public IdentityResult CreatePermissionRole(PermissionRole obj)
 {
     _permissionRoleStore.Create(obj);
     return(IdentityResult.Success);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Create new Permission Role Async
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public async Task <IdentityResult> CreatePermissionRoleAsync(PermissionRole obj)
        {
            await _permissionRoleStore.CreateAsync(obj);

            return(IdentityResult.Success);
        }
 public void Delete(PermissionRole entity)
 {
     this.DbEntitySet.Attach(entity);
     this.DbEntitySet.Remove(entity);
 }
 public void Create(PermissionRole entity)
 {
     this.DbEntitySet.Add(entity);
 }