SHARE
TWEET

Untitled

a guest Jun 25th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public async Task<IdentityResult> AssignRole(int userId, string roleName)
  2. {
  3.     IUser usr = await this.DBContext.Context.IdentityUsers.FirstOrDefaultAsync(r => r.Id.Equals(userId));
  4.  
  5.     this.DBContext.Context.Detach(usr);
  6.  
  7.     var result = await _user.AddToRoleAsync((User)usr, roleName);
  8.  
  9.     return result;
  10. }
  11.      
  12. public void Detach(ILCAssetsBase entity)
  13. {
  14.     this.Entry(entity).State = EntityState.Detached;
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top