public async Task <UserOwnership> GetUserOwnershipAsync(UserOwnership userOwnership) { using (var _context = new IdentityDBContext(_dbOptions)) { var task = await _context.UserOwnership.FindAsync(userOwnership.UserId, userOwnership.ConferenceId); if (task == null) { return(null); } return(task); } }
public async Task <UserOwnership> AddUserOwnershipAsync(UserOwnership userOwnership) { using (var _context = new IdentityDBContext(_dbOptions)) { var exists = GetUserOwnershipAsync(userOwnership).Result; if (exists != null) { return(exists); } _context.UserOwnership.Add(userOwnership); await _context.SaveChangesAsync(); return(GetUserOwnershipAsync(userOwnership).Result); } }