コード例 #1
0
 public void DeattachPermission(Permission permission, string userName)
 {
     Users user = this.ObjectContext.Users.First(x => x.UserName == userName);
     Permission permissionEntity = this.ObjectContext.Permission.First(x => x.Id == permission.Id);
     user.Permission.Attach(permissionEntity);
     user.Permission.Remove(permissionEntity);
     
     this.ObjectContext.AddToPermissionLog(CreateLog(string.Format("Odobrané právo {0}", permission.Name), 2, user.Id));
     this.ObjectContext.SaveChanges();
 }
コード例 #2
0
 public void AttachPermission(Permission permission, string userName)
 {
     Users user = this.ObjectContext.Users.First(x => x.UserName == userName);
     user.Permission.Add(this.ObjectContext.Permission.First(x => x.Id == permission.Id));
     //this.ObjectContext.SaveChanges();
     this.ObjectContext.AddToPermissionLog(CreateLog(string.Format("Pridané právo {0}", permission.Name), 1, user.Id));
     this.ObjectContext.SaveChanges();
 }