Exemplo n.º 1
0
 public void Update(Permission item)
 {
     // Check there's not an object with same identifier already in context
     if (this._context.Permission.Local.Select(x => x.Id == item.Id).Any())
     {
         throw new ApplicationException("Object already exists in context - you do not need to call Update. Save occurs on Commit");
     }
     this._context.Entry(item).State = EntityState.Modified;
 }
Exemplo n.º 2
0
        /// <summary>
        ///  Delete permission and associated category permission for roles
        /// </summary>
        /// <param name="permission"></param>
        public void Delete(Permission permission)
        {
            var catPermForRoles = _categoryPermissionForRoleRepository.GetByPermission(permission.Id);
            foreach (var categoryPermissionForRole in catPermForRoles)
            {
                this._categoryPermissionForRoleRepository.Delete(categoryPermissionForRole);
            }

               this._permissionRepository.Delete(permission);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Add a new permission
 /// </summary>
 /// <param name="permission"></param>
 public void Add(Permission permission)
 {
     permission.Slug = StringUtils.SafePlainText(permission.Slug);
     this._permissionRepository.Add(permission);
 }
Exemplo n.º 4
0
 public void Delete(Permission item)
 {
     this._context.Permission.Remove(item);
 }
Exemplo n.º 5
0
 public Permission Add(Permission permission)
 {
     return this._context.Permission.Add(permission);
 }