Beispiel #1
0
 public int Insert(IdentityRole role)
 {
     BOC.Entities.Role lRole = new BOC.Entities.Role();
     lRole.RoleName = role.Name;
     _BOCWebDBContext.Roles.Add(lRole);
     _BOCWebDBContext.SaveChanges();
     return 1;
 }
Beispiel #2
0
 public IdentityRole GetRoleByName(string roleName)
 {
     BOC.Entities.Role lRole = _BOCWebDBContext.Roles.Where(e => e.RoleName.Equals(roleName)).First();
     if (lRole != null)
     {
         IdentityRole lIdentityRole = new IdentityRole();
         lIdentityRole.Id = lRole.RoleId;
         lIdentityRole.Name = lRole.RoleName;
         return lIdentityRole;
     }
     else
     {
         return null;
     }
 }
Beispiel #3
0
 public int Update(IdentityRole role)
 {
     BOC.Entities.Role lRole = _BOCWebDBContext.Roles.Find(role.Id);
     if (lRole != null)
     {
         lRole.RoleName = role.Name;
         _BOCWebDBContext.SaveChanges();
         return 1;
     }
     else
     {
         return 0;
     }
 }