public void CheckAddDataAccessHierarchical(string userId, TenantBase linkedTenant) { if (linkedTenant == null) { throw new ArgumentNullException(nameof(linkedTenant)); } if (_context.Find <UserDataHierarchical>(userId) == null) { var dataAccess = new UserDataHierarchical(userId, linkedTenant); _context.Add(dataAccess); } }
/// <summary> /// This adds a UserDataHierarchical if not present, or updates the linked tenant if is present. /// </summary> /// <param name="userId"></param> /// <param name="linkedTenant"></param> public void AddUpdateDataAccessHierarchical(string userId, TenantBase linkedTenant) { if (linkedTenant == null) { throw new ArgumentNullException(nameof(linkedTenant)); } var dataLink = _context.Find <UserDataHierarchical>(userId); if (dataLink == null) { dataLink = new UserDataHierarchical(userId, linkedTenant); _context.Add(dataLink); } else { dataLink.Update(linkedTenant); } }