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; }
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; } }
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; } }