public void AddRole(int userId, int roleId) { var role = Entities.Rights.FirstOrDefault(rol => (rol.roleId == roleId) && (rol.userId == userId)); if (role == null) { Right right = new Right(); right.roleId = roleId; right.userId = userId; Entities.Rights.AddObject(right); Save(); } }
/// <summary> /// Deprecated Method for adding a new object to the Rights EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRights(Right right) { base.AddObject("Rights", right); }
/// <summary> /// Create a new Right object. /// </summary> /// <param name="id">Initial value of the id property.</param> /// <param name="userId">Initial value of the userId property.</param> /// <param name="roleId">Initial value of the roleId property.</param> public static Right CreateRight(global::System.Int32 id, global::System.Int32 userId, global::System.Int32 roleId) { Right right = new Right(); right.id = id; right.userId = userId; right.roleId = roleId; return right; }